aristanetworks / bst

A one-stop shop for process isolation
MIT License
99 stars 9 forks source link

pid,init: start basic init system in PID namespaces #2

Closed Snaipe closed 4 years ago

Snaipe commented 4 years ago

Some programs are ill-prepared when put in the boots of PID 1. In particular, programs may use wait() or waitpid(-1) to wait for any children to be collected, which normally works well when the children are themselves known. This breaks down if the process is init, because unaccounted orphans get reparented to them all the time, which most of the time is completely unexpected for the process.

To address this, pid namespaces now start a very basic init, whose whole purpose is to reap zombies, with a catch: if that init collects the main child process, it terminates immediately along with all other processes in the namespace rather than waiting for all processes to complete.

This behaviour can be disabled with --no-init.