aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>2009-09-23 18:57:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-24 10:21:04 -0400
commit123be07b0b399670a7cc3d82fef0cb4f93ef885c (patch)
treeb6edc440be85cf312f7c35ad7b01c7ce7d9241a7 /kernel
parent8d65af789f3e2cf4cfbdbf71a0f7a61ebcd41d38 (diff)
fork(): disable CLONE_PARENT for init
When global or container-init processes use CLONE_PARENT, they create a multi-rooted process tree. Besides siblings of global init remain as zombies on exit since they are not reaped by their parent (swapper). So prevent global and container-inits from creating siblings. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Acked-by: Eric W. Biederman <ebiederm@xmission.com> Acked-by: Roland McGrath <roland@redhat.com> Cc: Oren Laadan <orenl@cs.columbia.edu> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 51ad0b0b7266..b51fd2ccb2f1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -979,6 +979,16 @@ static struct task_struct *copy_process(unsigned long clone_flags,
979 if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM)) 979 if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM))
980 return ERR_PTR(-EINVAL); 980 return ERR_PTR(-EINVAL);
981 981
982 /*
983 * Siblings of global init remain as zombies on exit since they are
984 * not reaped by their parent (swapper). To solve this and to avoid
985 * multi-rooted process trees, prevent global and container-inits
986 * from creating siblings.
987 */
988 if ((clone_flags & CLONE_PARENT) &&
989 current->signal->flags & SIGNAL_UNKILLABLE)
990 return ERR_PTR(-EINVAL);
991
982 retval = security_task_create(clone_flags); 992 retval = security_task_create(clone_flags);
983 if (retval) 993 if (retval)
984 goto fork_out; 994 goto fork_out;