criu icon indicating copy to clipboard operation
criu copied to clipboard

MAP_FIXED_NOREPLACE undeclared

Open xinranwang17 opened this issue 1 year ago • 5 comments

I encoutered ‘MAP_FIXED_NOREPLACE’ undeclared when I build from source on branch criu-dev .

It seems it requires higher version of glibc, but I am not able to upgrade my glibc.

Can anyone can help on this?

$ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

I found it is related to commit 6d4eeb75a711625f8b34cfe660bae9f032dd7741, can anyone help on this? @liuchao173

xinranwang17 avatar Sep 27 '24 12:09 xinranwang17

glibc 2.17 is from 2012. Over 12 years old.

We try to support well known operating systems with a long lifetime like CentOS 7 for example. But at some point we have to drop support for really old things. We also dropped python2 support at some point.

It sounds unlikely that we will support really old things like flinch 2.17.

Which OS do you use that has such an old glibc?

adrianreber avatar Sep 27 '24 12:09 adrianreber

@xinranwang17 The fix is simple:

diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 1e3ffb967..a7ef34a83 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -809,6 +809,10 @@ static void parasite_memfd_close(struct parasite_ctl *ctl, int fd)
                pr_err("Can't close memfd\n");
 }
 
+#ifndef MAP_FIXED_NOREPLACE
+#define MAP_FIXED_NOREPLACE 0x100000
+#endif
+
 static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size, int remote_prot)
 {
        void *where = (void *)ctl->ictx.syscall_ip + BUILTIN_SYSCALL_SIZE;

but I agree with @adrianreber, it is unclear whether we need to support so old glibc...

avagin avatar Sep 27 '24 16:09 avagin

@adrianreber thanks for the information, I am using an internal os which has fixed glibc version. @avagin thanks, I will try this fix. Btw, is it possible to build criu from source in docker, and use the built binary directly on my host? Is there any limitation in this case?

xinranwang17 avatar Sep 29 '24 06:09 xinranwang17

is it possible to build criu from source in docker, and use the built binary directly on my host?

We run most of our CI tests in Docker containers. For example, you can use make docker-build to create a container image that includes all build dependencies and compiled CRIU binary. However, this binary is dynamically linked and will only work inside the container. We currently do not have a straightforward way of building a statically linked criu binary that can run in a different environment without the required shared libraries.

rst0git avatar Sep 30 '24 09:09 rst0git

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Oct 31 '24 00:10 github-actions[bot]