There is pain between fork() and exec(), fix spawning xwayland at least
This series comes from the realization here: !941 (comment 1457053)
Essentially, some of the most common things to do, like strdup()
or snprintf()
, are unsafe in the child process after fork()
but before exec()
when the parent program is multithreaded. Weston tries to be single-threaded but fails because it uses Mesa, and the test suite creates threads too. This series goes to great lengths in order to stop doing all those bad things in the code that spawns Xwayland.
This series is primarily meant to make CI more reliable, so that Xwayland test wouldn't hang at start sometimes. The frontend's child_client_exec()
is absolutely full of the same problems, and those are left for later. This MR adds all building blocks we need to fix fork+exec hopefully for good.
The building blocks are added here and there, because !932 (closed) or its successors aim to completely rewrite the process spawning code. So I expect these things to be moved around later.
This code is also pretty poorly tested. It seems to run, and if exec()
fails I see the error message, but otherwise there is little guarantee that it all works correctly in all cases.