Repository navigation
fix: checked pid conversion, remaining call sites (follow-up to #180, #179) - #182
Merged
Merged
Conversation
shell_exited passed a u32 pid straight to waitid. A value that does not fit in i32, or is zero, now returns true, the same answer the ECHILD path already gives for a child that is gone. Valid pids are unchanged. Adds checked_pid_keeps_valid_pids_and_rejects_the_rest, which covers 1, i32::MAX, 0, 2147483648 and u32::MAX. Commands run on a Linux arm64 host, in a fresh clone of the branch: - cargo test - cargo test --release - cargo fmt --check - cargo clippy -- -D warnings
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.
Refs #179
Refs #180
#180 (squash-merged to main as 203bbdd) fixed the checked pid conversion on the main path. The pid is now converted with
checked_pid, so debug and release builds give the same answer for pids that do not fit ini32. This PR is the follow-up for the call sites that #180 did not cover.Remaining call sites covered
poc/reverse-attach-linux/src/jobs/mod.rs,shell_exited: thewaitidcall now receives the pid fromcrate::proc::checked_pid. A pid that names no process returnstrue, the same answer the function already gives forECHILD. Before this change the rawu32was passed straight towaitid.Tests
New test:
checked_pid_keeps_valid_pids_and_rejects_the_restinpoc/reverse-attach-linux/src/proc_tests.rs. It checks that1andi32::MAXare kept, and that0,2^31, andu32::MAXare rejected.Results for head
c775a6e74e7735a72c15bd0eb7805b92ac8ad56b, run inpoc/reverse-attach-linux:cargo test(debug): 604 passed, 0 failed, 17 ignoredcargo test --release: 604 passed, 0 failed, 17 ignoredcargo fmt --check: no diagnosticscargo clippy -- -D warnings: no warningsNo Swift files changed.