fix: reject ambiguous module load instances - #302
Merged
Conversation
swananan
marked this pull request as ready for review
September 6, 2026 04:59
swananan
force-pushed
the
fix/cancellable-script-output
branch
from
September 6, 2026 12:40
d366401 to
9314b7d
Compare
swananan
force-pushed
the
fix/reject-ambiguous-load-instances
branch
from
September 6, 2026 14:13
35dcd6c to
a859154
Compare
swananan
force-pushed
the
fix/reject-ambiguous-load-instances
branch
from
September 6, 2026 14:39
a859154 to
2c99914
Compare
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.
Loading one ELF more than once can assign different load biases to the same
(PID, module cookie)map key. Both probes could then read one instance's globals, reporting 11 for an instance whose native value is 22.Reject ambiguous executable load instances at PID and target startup, including distinct files with the same Build-ID cookie. Read-only ELF mappings do not establish another load instance. Contradictory executable-segment evidence is rejected instead of falling back to an arbitrary mapping.
Check the actual probe load bias (
runtime IP - attached ELF PC) before rebasing global addresses. This also protects cross-module reads from a stale probe-module entry. A read-only mapping can no longer broaden the acceptance range to cover another instance.When sysmon detects ambiguity, remove the previous userspace snapshot and published offsets/ranges for the PID's runtime aliases. Module reconciliation invalidates rejected PIDs immediately and continues refreshing supported processes. Target cookie validation is reused while the executable mapping snapshot is unchanged.
The existing map ABI is unchanged. This patch rejects or invalidates unsupported instances; full multi-instance tracing and cross-namespace instance association remain separate work.
Validation:
-D warnings -D clippy::undocumented_unsafe_blocks.host -> docker-privatee2e passed locally: 361 tests each on the final runtime code. The last test-only applicability change was rechecked with all eight focused cases and full Clippy.2c99914passed all nine GitHub checks, including standard e2e, three full container topologies, and host-PID smoke. GitHub standard e2e's 361 test names exactly match the local run.Coverage boundary: nested child-container globals
-tremains unsupported, as documented indocs/container.mdand already handled by the existing globals target suite. The three late target-mode tests now reuse that same applicability helper. Final CI logs confirm all eight cases execute in host-to-private and private-same-sandbox; nested child-container executes the four startup rejection cases and PID late-load case, explicitly skipping the three unsupported runtime cases. Their value assertions remain active in the supported topologies.Rebased onto main after #301 merged; this PR contains one commit against main.