tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: next vforkup chapter: lwpctl



On Mon, Feb 14, 2011 at 03:33:03PM +0200, Antti Kantee wrote:
> On Mon Feb 14 2011 at 14:27:10 +0100, Joerg Sonnenberger wrote:
> > On Mon, Feb 14, 2011 at 03:16:11PM +0200, Antti Kantee wrote:
> > > The following patch makes a vfork child update the parent's lwpctl area
> > > while the child is running.  Comments or better ideas?
> > 
> > I think this is a very good case of "don't do that". malloc after
> > vfork() is just wrong. If rumphijack internally forces that for normal
> > system calls, it should downgrade vfork() to fork().
> 
> This is not about rumphijack.  Look at e.g. sh and make.
> 
> Even if you do fix them, it's not just limited to malloc either.
> Anything that uses LWPCTL will be screwed up after vfork.

I would require the same rules for vfork() in multithreaded programs
(and that includes "just" linking with libpthread) as for fork() -- only
async-safe functions should be called. Those should naturally not care
about LWPCTL.

Joerg


Home | Main Index | Thread Index | Old Index