Repository navigation
fix: preserve process identities in pwntools cleanup errors - #2284
Conversation
|
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, jeonjw85, for the fix and for sharing one helper between both error paths. Two other PRs also target #2274: #2281 and #2282. I ran all three the same way. ResultsHead 818c72c, base ec2d251 (#2212). Every pass below exited 0.
The 4 failures on base are the retirement cases. The 12 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) 🦊 |
|
@greptileai review |
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
|
Summary
Fixes #2274.
Include the recorded leader PID and process-group ID when a pwntools decoder or debugger retains a process after incomplete cleanup.
Problem and expected behavior
The provider retained the supervisor but reported only its run ID and runtime directory. A caller inspecting
cleanup_incompletecould not identify the retained process group. The directOwnedCommandfailure path already reported those identifiers.Change and scope
Both paths now use
ownedCommandResourcesto format the recorded launch ownership. The decoder continues to retain its supervisor and runtime until cleanup succeeds.This is a diagnostic fix within the existing provider boundary; no new capability or maintainer scope decision is needed.
Contract and boundary impact
details.resourcesgainspid:<leaderPid>andprocess-group:<processGroupId>entries. No schema or catalog change.Evidence and regression coverage
The existing stage-retirement tests now assert the exact projected resources for decoder and debugger stages, after both successful and failed commands. Those four cases failed on the base revision because the PID/group entries were missing. The direct owned-command tests also check both identifiers.
Representative resource list:
Validation performed
Using Node 24.18.0 and npm 11.16.0 on macOS:
npm run test:focused -- tests/process-global/pwntoolsStageRetirement.test.ts tests/boundary/process/ownedCommand.test.ts— 20 passed.npm run check— passed, with no lint errors.git diff --check— passed.The process tests use real macOS child processes with injected decoder launchers. I did not run the real Linux pwntools/pwndbg lane or native Windows verification.
Compatibility and release
Additive error diagnostics; no migration or release metadata changes.
Before merge