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

Linus Torvalds
2011-07-27T20:04:57Z

On Wed, Jul 27, 2011 at 9:31 AM, Oleg Nesterov <oleg@redhat.com> wrote:
>
> 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.

Well, I don't know how bad that is. You just kill the child instead.
That's how vfork has always worked, not just on Linux.

And quite frankly, I think your patches 1-3 are unbelievably ugly. If
it was some simple and straightforward "use
wait_for_completion_killable() instead", I wouldn't mind it. But I
think you made a simple and clean sequence convoluted and annoying.

I *suspect* that the killable() thing could be done more nicely by
moving the vfork_completion into the parent instead, and maybe the
vfork cleanup could just use
"complete(&task->parent->vfork_completion);" instead (so if the parent
goes away, it completes some irrelevant init case instead).

So *if* this can be done while still having straightforward code, I
think it might be worth doing. But patches 1-3 just make me go "not
worth the ugliness, especially since it's not a real problem".

Linus