Repository navigation
fix(native): name the retained pwntools process group in cleanup resources - #2281
Conversation
…urces When a pwntools or pwndbg stage cannot confirm that its owned process group stopped, the cleanup_incomplete result listed only the run ID and runtime directory, although a descendant can still be live. Add the retained supervisor's pid and process-group coordinates, as OwnedCommand reports for a non-transferred cleanup failure. Fixes #2274 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: On Linux with the real pwntools 4.15.0, this change works. If a stage cannot confirm its group retired, the error now adds the leader pid and the group id from the retained launch. A launch with no ownership record still gets no made-up ids. Thanks, kaoru0822-kitauji, for the issue and the fix. Two other PRs also target #2274: #2282 and #2284. I ran all three the same way. ResultsHead 8d1a4be, base ec2d251 (#2212). Every pass below exited 0.
This PR's test checks the form of the two labels, not their numbers. The real run below checks the numbers. Real run. With the real pwntools 4.15.0 and a real core file,
No ownership. In a test file of mine, not part of the PR, I removed the ownership record from the launch. The list stayed Limit. On Linux the group id equals the leader pid, so both labels show one number. No test can catch a swap of the two labels. Not run
Real run setupI wrote a small wrapper for REA_PWNTOOLS_PYTHON. It leaves one child in the same process group, with no run token (the marker REA gives each process it owns). Then it starts the real pwntools. REA cannot prove the child is its own, so it keeps the group. I made the core file with gdb from a small crashing C program. Test setup
Commands🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
Summary
Sometimes a pwntools or pwndbg provider stage can't confirm that its owned process group stopped.
PwntoolsDecoder.#retireProcessthen builds the retainedProviderCleanupErrorwith only the run ID and the private runtime directory. In that state a descendant of the retained group can still be live: the existing stage-retirement test assertsprocess.kill(descendant, 0)succeeds. Yet the projectedcleanup_incompleteresult did not identify the process group the caller must inspect.While the supervisor is retained, the resources now also include
pid:<leaderPid>andprocess-group:<processGroupId>from its launch ownership. That matchesOwnedCommand's own non-transferred cleanup error ([runId, cwd, pid:…, process-group:…]). Nothing else changes.Codex raised this on #1708 after it merged (
PwntoolsDecoder.ts:521).Fixes #2274
Before / after (
does not read unresolved $stage files after command $outcome, all four cases)Validation
tests/process-global/pwntoolsStageRetirement.test.ts: the four unresolved-cleanup cases now assertpid:andprocess-group:resources. They fail on main and pass with this change; all 8 tests in the file pass. The tests simulate the Linux x64 decoder gate and use real owned processes on this macOS host.npm run lintpasses.npm test: 9566 passed, 15 failed in 8 files:origin/mainon this host: Hopper not installed, Command Line Tools only (ibtool),hdiutil, and inspector target-location cases.tests/boundary/process/processSettlementDeadline.test.ts > still reports observed liveness as alive_at_deadline(added today in fix(process): report single empty settlement observation as unverifiable #2232), also fails when run alone on cleanorigin/mainhere. It is unrelated to this change: it spawns/bin/sleepand waits to observe the run token in that process's environment, which this macOS host does not expose for a platform binary.Not addressed here: Codex's other post-merge note on #1708 (
PwntoolsDecoder.ts:477, refresh captured diagnostics after a successful cleanup retry). It depends on output arriving between the first incomplete stop and the retry, which I could not reproduce deterministically.🤖 Generated with Claude Code