SV: Re: [PATCH] Fix runsvdir so it reaps children and avoid zombi processes when killed.

Markus Gothe nietzsche at lysator.liu.se
Thu Jan 4 20:55:17 UTC 2018


Well, just to be sure we all talk about the same children that needs to be reaped are those of runsvdir, the bug manifests without using the inittab, surely init will reap the dead process of runsvdir but not the children themselves of runsvdir.

Skickad via BlackBerry Hub för Android

  Ursprungligt meddelande  
Från: ska-dietlibc at skarnet.org
Skickat: 4 januari 2018 16:04
Till: busybox at busybox.net
Svara till: ska-dietlibc at skarnet.org
Ämne: Re: [PATCH] Fix runsvdir so it reaps children and avoid zombi processes when killed.

>Please point out the code in init.c which you think is buggy.

  https://git.busybox.net/busybox/tree/init/init.c#n1216 is buggy.

  Unconditionally sleeping when signals may arrive is a no-no. If
a child dies right before this line, or during the sleep, init will
not handle the signal immediately. It will sleep the full second, and
only handle the signal - and reap the zombie - after the sleep is done.

  This is not theoretical. I have personally hit the race window
several times. On Alpine Linux, a test for some javascript package
got confused because it was (erroneously) basing a timer on how long
it took for a child to be reapt, and consistently hitting more than
one second.

  The way to fix this is to completely redesign the loop. Currently
it's a mess of two nested loops with several check_delayed_sigs()
calls inside - no matter how many you have, it's still racy.
The proper way to design the loop is to have a single loop, not a
nested one, with either a self-pipe to handle signals, or a
pselect()/ppoll() call with a signal mask.

--
  Laurent

_______________________________________________
busybox mailing list
busybox at busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list