[PATCH 0/8] make vfork killable/restartable/traceable

From: Oleg Nesterov
Date: Wed Jul 27 2011 - 12:35:14 EST


Hello.

CLONE_VFORK sleeps in TASK_INTERRUPTIBLE until the child exits/execs.
This is obviously not good, it is sooo simple to create the task which
doesn't react to SIGKILL/SIGSTOP.

Questions:

- do we really need this?

I think we do. This really "looks like a bug" in any case,
even if nobody ever complained afaik.

- may be 1-3 is enough?

may be... but personally I think SIGSTOP/ptrace should work
too.

- is it safe to exit/stop on !x86 machine???

I do not know. May be this needs some #ifdef's around
wait_for_completion_interruptible(). I am not sure that,
say, arch_ptrace_stop() can't abuse the ->mm shared with
the child.

OTOH. This can happen anyway, do_fork() does ptrace_event()
before wait_for_completion().

- and of course, while I think this is bugfix, this is user
visible change.

Please comment.

9/8 is off-topic.

Oleg.

fs/exec.c | 11 ----
include/linux/sched.h | 2 +-
include/linux/thread_info.h | 4 ++
kernel/fork.c | 121 ++++++++++++++++++++++++++++++++++---------
kernel/pid.c | 13 +++++
5 files changed, 114 insertions(+), 37 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/