CLONE_PARENT shouldn't allow to set ->exit_signal
authorOleg Nesterov <oleg@redhat.com>
Wed, 14 Mar 2012 18:55:38 +0000 (19:55 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 20 Mar 2012 21:16:50 +0000 (14:16 -0700)
commit5f8aadd8b9966d71a77bba52b9d499cc2f38269f
tree229735d79edf0c4cc82ac00ba1abaee63040ff6e
parented378a52dabf77b406b447fd3238f83ea24b71fa
CLONE_PARENT shouldn't allow to set ->exit_signal

The child must not control its ->exit_signal, it is the parent who
decides which signal the child should use for notification.

This means that CLONE_PARENT should not use "clone_flags & CSIGNAL",
the forking task is the sibling of the new process and their parent
doesn't control exit_signal in this case.

This patch uses ->exit_signal of the forking process, but perhaps
we should simply use SIGCHLD.

We read group_leader->exit_signal lockless, this can race with the
ORIGINAL_SIGNAL -> SIGCHLD transition, but this is fine.

Potentially this change allows to kill self_exec_id/parent_exec_id.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/fork.c