Stop registry writes at exit and the drain at teardown

Draft
XA
2d ago
+295-22

Intent: Once a process records its exit, it stops writing the lifecycle registry; once its teardown begins, its signal drain stops acting on records.

Failure fixed: After a fork child exited, a late reparent record or a worker still in fork marked it live again in the registry; the adopter's waitpid(-1) hung (#571). A record drained after the guest was unmapped wrote the shim page and crashed the host process (#552, #574). Linux 6.18 reports ECHILD and exits normally.

This PR:

  1. proc_process_exit marks the exit under the registry flock; later registry writes are refused.
  2. launch_destroy_guest closes the drain before every unmap.

They replace the earlier exit-time close.

Release builds on 0caec7d:

  • O-09: without commit 1, 4/5 reaped children revive (3/3 runs).
  • late reaped: without commit 1, fails 10/10 runs.
  • test-teardown-signal: without commit 2, SIGSEGV in 5/5 runs.
  • ASAN, #552's probe: without commit 2, 20 reports per run; 0 with it.
Lanes
  • 8 late lanes plus 8 busy loops: 0/160 hung (#571: 19/192 on upstream/main).
  • make check: busybox nslookup times out, as on 0caec7d (host DNS); the 29 lanes after it pass under make -k. lint passes. test-matrix: only Rosetta audit-known-limitations fails, as on upstream/main on 12-03.

Untested: setsid, setpgid, prctl and auto-reap writes, behind the same gate.

Fixes #552
Fixes #571
Fixes #574