Repository navigation
Conversation
|
1: These scenarios will not actually come to pass. 2: Clearly, AI cannot understand the intent behind its design. |
|
@roothider Thank you for the clarification. My concern came from the absence of explicit cache invalidation and from the metadata cache being keyed only by PID. However, I understand that my regression harness modeled PID reuse at the cache level and did not prove that this state is reachable through launchd’s actual process and XPC lifecycle. Could you clarify which lifecycle guarantee prevents these scenarios—for example, whether the relevant PID cannot be reused while the cache is alive, or whether every queried PID is guaranteed to refer to the same live process instance that was registered? I would like to understand the intended design and avoid proposing an unnecessary change. If the state is genuinely unreachable, I’ll close the PR. |
|
The kernel does not reuse the unique ID, and the unique ID does not change during |
|
@roothider Understood. Thank you for the explanation and for taking the time to review the PR. I’ll close it and look for another issue to work on. Have a nice day 👍 |
Problem
The launchd hook records each successfully spawned process as:
However,
get_job_cache()previously returned the stored value without checking whether the process currently using that PID still had the samep_uniqueid.The job metadata cache had a separate problem: it stored path and bundle identifier by PID only.
As a result:
Change
This patch makes the existing
p_uniqueidvalue part of cache validation:get_job_cache(pid)now compares the registered unique ID with the unique ID of the process currently using that PID.The cache remains keyed by PID and bounded by the PID space. This does not add process-exit monitoring; stale entries are rejected lazily by validating the current process identity when they are accessed.
Validation
libjailbreak.dylibandlaunchdhook.dylibfor arm64 and arm64e.The original implementation returned stale metadata in the reuse test. The patched implementation rejected it and returned metadata for B only after B was registered.