RFC: Enforcing process hierarchies (`prctl` related)

Ciprian Dorin Craciun ciprian.craciun at gmail.com
Sat Aug 25 14:08:14 EDT 2012


On Sat, Aug 25, 2012 at 8:48 PM, Mulyadi Santosa
<mulyadi.santosa at gmail.com> wrote:
> Hi........
>
> On Fri, Aug 24, 2012 at 11:20 PM, Ciprian Dorin Craciun
> <ciprian.craciun at gmail.com> wrote:
>>     (d) (last resort solution we have today) iterate through
>> `/proc/$PID` and find all the controller children, SIGKILL them, and
>> continue until no process is found, then die; but it doesn't solve
>> (C)...
>
> IMHO this is the way to do it....but, to tackle C, maybe a signal
> handler to SIGTERM could do it. But wait, I forget whether SIGTERM
> could be intercepted.....

    Solving (C) (that is terminating all children if the controller
suddenly dies) is impossible to achieve from the controller process
itself as if it dies it can't proceed to killing the children
processes, thus they are leaking to the next process reaper (most
probably `init` itself). (The only way to solve this is to use the
`clone (CLONE_NEWPID)`, but as said you need special privileges to
call it...)



More information about the Kernelnewbies mailing list