Re: [PATCH v2 0/3] make vfork killable

From: Matt Helsley
Date: Tue Aug 23 2011 - 18:02:19 EST


On Sat, Aug 13, 2011 at 06:18:14PM +0200, Tejun Heo wrote:
> Hello, Oleg.
>
> On Fri, Aug 12, 2011 at 07:55:50PM +0200, Oleg Nesterov wrote:
> > > an alternative approach
> > > could be handling vfork waiting as a type of job control stop.
> >
> > Well, I didn't see the code, but to be honest this doesn't look
> > like a good idea to me. Firstly, personally I do not think this
> > has something to do with the job control stop.
> >
> > And, to me sys_restart_syscall() looks like the very natural
> > approach, and simple.
>
> I've been playing with this and it does a bit further than
> implementation simplicity. Currently, we have three different modes
> of stopping a task.
>
> * Regular job control and ptrace.
> * vfork wait.
> * cgroup freeze.
>
> Currently, all three behave differently and the latter two use
> UNINTERRUPTIBLE sleep causing rather nasty problems. If we want to
> fix the UNINTERRUPTIBLE sleep problem, we end up introducing a new
> user visible state no matter which way we go - ie. a task will be in a
> state which isn't UNINTERRUPTIBLE sleep but still behave differently
> in terms of signal delivery and job control.
>
> What's needed is this different state of being stopped which reponds
> to all kernel's desires (killing and ptracing) but stays stopped
> regardless of what the user requests.
>
> There's multiple ways to implement this and forced syscall restart is
> one way to achieve it - ie. while the stop condition is pending,
> syscall is forced to be restarted after interruption and re-enter
> stop. The downside is that that wouldn't work with cgroup freeze at
> all - there's no syscall to restart.
>
> So, what I'm proposing is to basically add another job control state
> which is similar to process group stop but controlled by other
> parameters like vfork wait condition or control group frozen state.

Are you proposing one new jobctl state for vfork and another for
the cgroup freezer?

> This allows these stops to be handled in a way very similar to already
> esablished job control states including interaction with ptrace.

Interesting. So long as shells and ptracers in containers would not see
jobctl traps/events triggered by tasks outside the container it sounds
fine.

Cheers,
-Matt Helsley
--
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/