Subject: Re: popen reentrant (was Re: SA/pthread and vfork)
To: Christos Zoulas <christos@zoulas.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 09/10/2003 13:38:21
christos@zoulas.com (Christos Zoulas) writes:

> In article <200309101219.h8ACJ2u04640@mail.Pin.LU>,
> Christian Limpach <chris@pin.lu> wrote:
> >
> >There's still the issue of upcalls happening while the child is still
> >running on the parent's stack.  An upcall will save the ucontext on the
> >same stack and thus trash it.  Should we just block/hold all upcalls
> >between vfork and when execve clears P_PPWAIT?
> 
> It seems to me that the vfork semantics should be changed so that upcalls
> should not be happening while the child is running on the parent's stack.
> Maybe we should introduce a process flag that indicates P_INVFORK, and
> have execve clear it. While a process is in P_INVFORK, it cannot execute
> upcalls.

Again, I think this is the wrong approach. Instead of making vfork()
work with SAs, we should consider avoiding vfork() in threaded
programs and taking the hit of calling ordinary fork() instead.

        - Nathan