mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
check: try to call clone with CLONE_NEWPID and CLONE_PARENT
This combination was forbidden in 3.12 commit 40a0d32d1eaffe6aac7324ca92604b6b3977eb0e : "fork: unify and tighten up CLONE_NEWUSER/CLONE_NEWPID checks" and then it was permited again in 3.13: commit 1f7f4dde5c945f41a7abc2285be43d918029ecc5 fork: Allow CLONE_PARENT after setns(CLONE_NEWPID) Cc: Adrian Reber <adrian@lisas.de> Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
e880dbd9b8
commit
1776821876
28
cr-check.c
28
cr-check.c
@ -726,6 +726,33 @@ static int check_fdinfo_lock(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clone_arg {
|
||||
/*
|
||||
* Reserve some space for clone() to locate arguments
|
||||
* and retcode in this place
|
||||
*/
|
||||
char stack[128] __attribute__((aligned (8)));
|
||||
char stack_ptr[0];
|
||||
};
|
||||
|
||||
static int clone_cb(void *_arg) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int check_clone_parent_vs_pid()
|
||||
{
|
||||
struct clone_arg ca;
|
||||
pid_t pid;
|
||||
|
||||
pid = clone(clone_cb, ca.stack_ptr, CLONE_NEWPID | CLONE_PARENT, &ca);
|
||||
if (pid < 0) {
|
||||
pr_err("CLONE_PARENT | CLONE_NEWPID don't work together\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int (*chk_feature)(void);
|
||||
|
||||
int cr_check(void)
|
||||
@ -780,6 +807,7 @@ int cr_check(void)
|
||||
ret |= check_mnt_id();
|
||||
ret |= check_aio_remap();
|
||||
ret |= check_fdinfo_lock();
|
||||
ret |= check_clone_parent_vs_pid();
|
||||
|
||||
out:
|
||||
if (!ret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user