Prevent starter from killing itself accidentally

This patch aims to fix a race condition where a user of subprocess.cc
(e.g. starter) and `shm_event_loop` can kill itself accidentally. This
generally happens when the user attempts to kill the child before the
`exec()` call has happened. In that case, the
`SignalHandler::DoHandleSignal()` function from `shm_event_loop.cc`
runs inside the child, but actually writes the quit event to the pipe
that the parent is listening to.

The fix here is to block the signals before the fork. The parent
process will unblock the signals before exiting from the `DoStart()`
function. The child will first restore the default signal handlers and
_then_ unblock the signals. This will cause the child process to
terminate as expected when it sees a relevant signal.

If I undo the changes in `subprocess.cc`, the test becomes flaky.

    $ bazel test //aos/starter:subprocess_reliable_test --runs_per_test=1000
    ...
    FAILED in 986 out of 1000 in 100.6s

References: PRO-23549
Change-Id: I958071df561bcdef78088740136e52a8956dfffe
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/starter/BUILD b/aos/starter/BUILD
index 732cfe3..1873166 100644
--- a/aos/starter/BUILD
+++ b/aos/starter/BUILD
@@ -93,6 +93,24 @@
     ],
 )
 
+# Similar to subprocess_test, but here are all the tests that are not flaky.
+cc_test(
+    name = "subprocess_reliable_test",
+    srcs = ["subprocess_reliable_test.cc"],
+    data = [
+        "//aos/events:pingpong_config",
+    ],
+    # The roborio compiler doesn't support <filesystem>.
+    target_compatible_with = ["@platforms//os:linux"],
+    deps = [
+        ":subprocess",
+        "//aos/events:shm_event_loop",
+        "//aos/testing:googletest",
+        "//aos/testing:path",
+        "//aos/testing:tmpdir",
+    ],
+)
+
 cc_test(
     name = "starter_test",
     srcs = ["starter_test.cc"],