Re: [capsicum] wait() and pdfork()




On 18 Mar 2014, at 15:11, David Drysdale <drysdale at google.com> wrote:

I fully agree with David. A process created with pdfork(2) has a PID, so
syscalls operating on PIDs (wait*(), kill(2), etc.) should continue to
work. Also note a special case when the PD_DAEMON flag is used for
pdfork(2) and the process can exists even if all process descriptors are
closed.

Hmm, I think there's a possible awkward interaction with PD_DAEMON processes.  If a PD_DAEMON process gets reparented to init, and subsequently terminates, how does init reap it, given that pdfork()ed processes are invisible to waitpid(-1,...)?

Maybe make a PD_DAEMON process visible to (and reapable by) waitpid(-1,. ...) when the last process descriptor for it is closed?

More generally, I've started building a table with my current guesses for process descriptor behaviours -- feedback/discussion welcome:

Yes, the PD_DAEMON semantics were added later and are perhaps not as coherent as one would like. I see two ways (off hand) to make behaviour coherent:

(1) Make the non-exposure dependent on having a process descriptor rather than using pdfork()
(2) Make pdfork()'d processes whose descriptor has closed behave as though SA_NOCLDWAIT had been set -- i.e., it simply garbage collects without being reaped.

Robert



This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.