tech-kern archive

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

Re: wait(2) and SIGCHLD



On 2020-08-16 21:17, Mouse wrote:
They don't vanish, they get reparented to init(8) which then wakes
up and reaps them.
That probably would work, approximately,

Well, it does work, to at least a first approximation.

but isn't what's supposed to happen when a child's parent is ignoring
SIGCHLD - the child should skip zombie state, and simply be cleaned
up.

And how is "reparent to init" not an acceptable means of implementing
that?

Acceptable or not, it would seem to not match our own documentation.

From the sigaction() man-page:

SA_NOCLDWAIT If set, the system will not create a zombie when the child exits, but the child process will be automatically waited
                    for.  The same effect can be achieved by setting the
                    signal handler for SIGCHLD to SIG_IGN.

The difference would be detectable if init were sent a SIGSTOP
(assuming that isn't one which would cause a system panic)

I don't think it would panic, but I think that, if it really does stop
init, it's a bug that it does so.  I thought I'd seen some code that
rendered init immune to SIGKILL and possibly SIGSTOP too (maybe by
forcing them into init's blocked-signals set? I forget).  But I can't
seem to find it now.

SIGSTOP is one of two signals that a process supposedly should not be able to intercept. Of course, init is special enough that normal rules might not apply...

so it would stop reaping children (temporarily) - processes of the
type in question should not be showing up as zombies.

Right, they shouldn't be.  But init shouldn't be stopped, either.

Similarly, I think it should be impossible to ptrace init, and I have a
fuzzy memory that it was on at least one system I tried it on.

I'll be poking around a bit more.

How special do one really want init to be?

  Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index