Repository navigation
feat(native): Windows actual-target process identity on a retained handle - #4326
Open
code-yeongyu wants to merge 1 commit into
Open
code-yeongyu wants to merge 1 commit into
code-yeongyu wants to merge 1 commit into
Conversation
…ndle Adds the S7 adapter of the #4199 design (4.2a "OS identity"): a non-inheritable OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | SYNCHRONIZE) handle on which GetProcessId, the full 64-bit creation FILETIME, the TokenUser SID and the exit state are read, plus a process-object exit wait. process_identity::observe applies the design's observation table to a reopened PID: matching live identity is Live; a signalled object, a different readable creation time (test 11 deterministic reuse) or an absent PID is Gone; access denied, unreadable fields, an unexpected SID or a handle naming another PID is Unknown. Native receipts (tests/native_process_receipts.rs) run in the existing socket-secret-native-windows job on a real child process. Part of sisyphuslabs/omo-desktop-app#4199
This branch has not been deployed
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.
Part of sisyphuslabs/omo-desktop-app#4199 (senpi PR S7 in the approved #4199 design's plan: the native Windows actual-target process identity adapter and its observation classifier). Stacked on #4302.
Summary
src/process_handle.rs:RetainedProcess::open(pid)opens a non-inheritableOpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | SYNCHRONIZE)handle;facts()readsGetProcessId, the full 64-bitGetProcessTimescreation FILETIME, theTokenUserSID (OpenProcessToken(TOKEN_QUERY)+GetTokenInformation+ConvertSidToStringSidW) and the exit state, all on that same handle;wait_for_exit(ms)waits on the process object.observe_pid(pid)reopens once (an absent PID isERROR_INVALID_PARAMETER->NoSuchProcess).src/process_identity.rs:observe(record, observation)applies the design's observation table (4.2a): matching live identity ->Live; signalled object, different readable creation time, verified absent PID ->Gone; access denied, unreadable creation time/SID/exit state, unexpected SID, handle naming another PID, invalid record ->Unknown.Gonenever authorizes signalling or adopting the PID's current holder; that is the caller's contract (S10/S13).Tests
observe(Unknown(OpenFailed)where the table expectsLive/Gone(CreationTimeDiffers)/Unknown(CreationTimeUnreadable)).cargo test -p senpi-socket-secret --locked13 passed:the_observation_table_rows(design table, 8 rows),test_11_deterministic_pid_reuse_is_gone_even_while_the_replacement_lives(design test 11 fakes: replacement created 134000000010000000 at the same PID/SID; one-tick mismatch),every_unreadable_or_inconsistent_answer_is_unknown.-D warningsfor x86_64- and aarch64-pc-windows-msvc rc=0.tests/native_process_receipts.rs, real Windows only, run by the existingsocket-secret-native-windowsfixture-free step;RECEIPT_IDENTITYlines): a live child matches its record and its exit is observed through the retained handle; a one-tick-older record at the same PID isGone; a wrapper's identity recorded against the child's PID is notLive; an unused PID isNoSuchProcess. Not run locally (no Windows host, no VM by rule): CI is the receipt.Gates
gated-push (each gate its own process, rc=0): cargo fmt check, crate test, clippy Windows x64 + arm64, check-pr-changelog (
no-changelog; crate is fork-only, no upstream-owned path changed).