Async-signal-safe handler that forwards SIGTERM to every process we own: the libkrun VM worker and the gvproxy helper. We cannot rely on Rust destructors (`GvproxyGuard::drop`, `ManagedDriverProcess::drop`) running on signal-driven exit, so we explicitly deliver the signal here. The `wait_for_child` loop reaps libkrun and `cleanup_gvproxy` reaps gvproxy before `run_vm` returns. Only async-signal-
(_sig: libc::c_int)
| 1325 | /// POSIX.1-2017 as async-signal-safe, atomic loads are lock-free on the |
| 1326 | /// platforms we target. |
| 1327 | extern "C" fn forward_signal(_sig: libc::c_int) { |
| 1328 | let vm_pid = CHILD_PID.load(Ordering::Relaxed); |
| 1329 | if vm_pid > 0 { |
| 1330 | unsafe { |
| 1331 | libc::kill(vm_pid, libc::SIGTERM); |
| 1332 | } |
| 1333 | } |
| 1334 | let gv_pid = GVPROXY_PID.load(Ordering::Relaxed); |
| 1335 | if gv_pid > 0 { |
| 1336 | // gvproxy handles SIGTERM cleanly; no need for SIGKILL. |
| 1337 | unsafe { |
| 1338 | libc::kill(gv_pid, libc::SIGTERM); |
| 1339 | } |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | fn wait_for_child(pid: i32) -> Result<libc::c_int, String> { |
| 1344 | let mut status: libc::c_int = 0; |