fix(nativeguest): reap the zombies session processes adopt as subreapers and never wait for (#3610)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-12-02 20:31:58 -05:00
1 parent 4ab9635ceb
commit 20df8b1858
7 files changed
+464 -2

No files matched your search

+7
View File
@@ -87,6 +87,11 @@ static const char *rewrite_path(const char *path, char *out, size_t size) {
return path;
}
// The native hook's SIGCHLD handling (hook/signals.c) is not part of this shim: its programs record their
// first parent for the session's subreapers, and reap nothing themselves.
static void ddnatv_manage_sigchld(void) {}
static void ddh_reap_unclaimed(void) __attribute__((unused));
#include "../nativeguest/hook/kept.c"
#include "../nativeguest/hook/handoff.c"
@@ -315,12 +320,14 @@ pid_t fork(void) {
}
ddh_prepare();
pid_t forker = (pid_t)syscall(SYS_gettid);
pid_t forking = (pid_t)syscall(SYS_getpid);
pid_t pid = orig_fork();
if (pid == 0) {
kept_forked();
kept_close_forked();
ddh_drop_worker_binder();
ddh_forked(forker);
ddh_record_parent((pid_t)syscall(SYS_getpid), forking);
} else if (pid > 0) {
ddh_child_created(pid, 1);
}