Skip to content

fix(helper): match dyld inserts by file name#82

Closed
athexweb3 wants to merge 2 commits into
mainfrom
fix/injection-file-name-matching
Closed

fix(helper): match dyld inserts by file name#82
athexweb3 wants to merge 2 commits into
mainfrom
fix/injection-file-name-matching

Conversation

@athexweb3

Copy link
Copy Markdown
Contributor

What

Ports the SimBLE injection hardening. DYLD_INSERT_LIBRARIES entries are matched by slice file name, not exact path, and teardown removes our slice by its canonical name rather than a locator-resolved path.

Why

A re-arm from a relocated build tree could double our entry, and clearInjection skipped cleanup whenever the locator could not resolve a path (a moved or deleted slice), leaving a stale DYLD entry behind. File-name matching fixes both and keeps SimEnclave and a peer tool (SimBLE) coexisting on the shared variable.

How

  • InjectionEnv.composed/removed match on the file name via a fileName helper; a re-arm with a relocated path replaces our entry instead of doubling it.
  • HelperModel.clearInjection gates on the variable being set and removes by SimPlatform.dylibName, so teardown succeeds even after the slice moves.
  • New tests assert dedupe-by-name on re-arm and locator-independent removal.

No change to the fence: the interposer stays a simulator-slice, debug-only binary, and arming still resolves the real path.

Testing

make test green: C tests, all four Swift packages (including the new InjectionEnv cases), the fence and its self-test, and mechanism C.

Checklist

  • Scoped to one thing, small enough to review in a sitting
  • Conventional commits, CI green
  • No change to the mechanism, protocol, or security model (injection teardown hardening only)
  • Nothing here lets the interposer reach a production build

athexweb3 added 2 commits July 4, 2026 10:39
composed and removed match on the slice file name, not the exact path,
so a re-arm from a relocated build never doubles our entry and teardown
finds our slice after the path moves.
clearInjection removed our slice only when the locator still resolved a
path, so a moved or deleted slice left a stale DYLD entry. Remove by the
platform's canonical slice name instead; a peer tool's entry is untouched.
@athexweb3
athexweb3 requested a review from 0xnirapod as a code owner July 4, 2026 04:45
@athexweb3

Copy link
Copy Markdown
Contributor Author

Superseded: the same file-name matching and by-name teardown already landed in #80 and shipped in v1.1.2. Closing.

@athexweb3 athexweb3 closed this Jul 4, 2026
@athexweb3
athexweb3 deleted the fix/injection-file-name-matching branch July 4, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant