Repository navigation
fix(core): keep zombie leaders with live threads in containment; deflake boot mode test - #330
Merged
Merged
Conversation
A zombie thread-group leader can still have live threads. Its own environ fails with ESRCH, so containment probes treated it as gone and could confirm an empty scope while its threads ran. Count a zombie as gone only when num_threads is at most one. Read the environment of such a leader through a live thread, so it goes through the normal token and foreign-member checks. Closes #322
…shot line The fake adb reported a finished boot at once, so startEmulator could read the log before the fake emulator wrote its snapshot line and report an unknown boot mode. A real emulator logs that line before the guest can report boot, so gate the fake adb on it. Closes #328
3 tasks done
…t reads empty Some kernels return an empty environ for a thread-group leader that has no memory of its own, instead of failing with ESRCH.
…es it exec A surviving thread can exec between the environ read and the stat read. A live process then proves nothing, so do not report it gone.
…nviron On kernel 6.17 a zombie leader's own environ fails with EACCES, while a live thread still shows the environment.
…nt-zombie-boot-log
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Containment cleanup now treats a zombie thread-group leader that still has live threads as present, using the same
num_threads > 1rule as the group stop inproc.ts. Such a leader's own/proc/<pid>/environcannot be read: depending on the kernel it fails with ESRCH (7.2) or EACCES (6.17 on the CI runner), or reads as empty. When the stat shows state Z with more than one thread, containment reads the environment through a live thread, so the normal token and foreign-member checks still run. A process that is live again by the time of the stat read, for example after a surviving thread exec'd, stays unverified and is never reported gone. The Android boot-mode test no longer races the fake emulator's log line.Closes #322
Closes #328
pthread_exitwhile another thread runs. The host kernel shows State Z, Threads 2, and/proc/<pid>/environreturns ESRCH. A live thread'stask/<tid>/environreads normally.num_threads > 1is present. Z with one thread stays gone.containment.test.tsfails on main withexpected [] to include <pid>and passes herecgroup.procs.containment-cgroup-sim.test.ts: "signals a proven zombie leader…" and "refuses a foreign zombie leader…". Both failed on main.containment.test.tsgetprop sys.boot_completed.detectBootModeoutput is only reported.emulator.test.tsemulator.test.tsPICKFORGE_REQUIRE_BROWSER=1 vitest run --coveragelistContainedIdentities).osv-scanner.toml.QA pass skipped: this changes internal process-teardown logic with no UI or CLI output to drive. The real-kernel test exercises the behaviour end to end.
Reviews: Astra and Fable (xhigh) both reviewed every round. Fable asked for a real-kernel test, which then showed that the runner kernel answers with EACCES. Astra found an exec race between the environ read and the stat read, fixed in 981be6c. Both reviewers confirmed every fix, and the last rechecks found nothing blocking. Fable's suggestion to share the zombie rule with
proc.tswaits until the parallelproc.tschange lands.