Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
bootloader: use waitpid instead of wait #2966
Doing so works fine in most cases, but when the child process itself plays with
It will then delete the previously extracted files, and so create a race condition (the child might not have loaded all its libraries yet).
No real objections here. The code is more or less equivalent.
I haven't heard of any interaction between waitpid(-1, ...) and switch_root so I don't know exactly how the problem is solved by waiting for a particular PID instead of any PID, so I just have to trust OneBlue that this solution works.
@codewarrior0 : Pretty much.
I wanted the student code to run in a lightweight sandbox (so a VM would be too heavy) so I basically wrote a python program that would create a chroot, create new network / process namespaces and then call switch_root to jump in to chroot.
I had a deeper look today and I finally understood the root cause.
Here is the output of
Sorry for long post, I hope it's clear :).
TL;DR: switch_root forks and then calls