Skip to content

fix(native): match the arm64e.v1 dwarfdump UUID row - #4288

Closed
Henglie wants to merge 2 commits into
morluto:mainfrom
Henglie:fix/macho-arm64e-uuid-row
Closed

Henglie wants to merge 2 commits into
morluto:mainfrom
Henglie:fix/macho-arm64e-uuid-row

Conversation

@Henglie

@Henglie Henglie commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

inspect-macho reported a false dwarfdump --uuid returned no row for selected architecture arm64e.v1 limitation when it selected an arm64e.v1 slice of a
universal Mach-O. The UUID itself was correct, so successful Evidence carried
uncertainty metadata it had not earned.

Row selection compared the dwarfdump architecture label with string equality,
while the slice tools are invoked with the CPU-family name. This makes the
comparison use the same family name the tool was asked about.

Fixes #4195.

Problem and expected behavior

lipo names an arm64e slice with its pointer-auth ABI version (arm64e.v1).
dwarfdump --uuid reports the CPU-family name for the slice it was asked about
((arm64e)), and REA already invokes it with the version stripped:
toolArchitectureName in NativeMachoInspection.ts strips a trailing .vN
for every tool except dyld_info.

Only the row comparison was left asymmetric. It filtered rows with
architecture === selectedArchitecture, so a correct (arm64e) row never
matched the arm64e.v1 selection, and the parser reported "no row" even though
the row was present and the UUID agreed with LC_UUID.

Expected: a versioned selection finds its row, and a row that is genuinely
absent is still reported as absent.

Change and scope

  • src/native/parsers/machoUuid.ts: add dwarfdumpArchitectureName, which
    strips a trailing pointer-auth ABI version (.vN), and use it on both sides
    of the row comparison in selectDwarfdumpRow.
  • Variants other than the pointer-auth ABI version are deliberately left to
    match exactly. arm64e.x1 is a distinct subtype that the tools address only
    by its exact name, and I did not assume dwarfdump collapses it to arm64e;
    a test pins that behaviour so the fix cannot silently widen into a guess.
  • No new capability, no new tool, no contract change. This is a fix inside the
    existing UUID reconciliation boundary, so no maintainer scope decision is
    required ("not applicable").

Contract and boundary impact

  • Semantic owner and earliest changed stage: UUID reconciliation, after the
    slice tool output is captured. No tool is invoked differently.
  • Contribution scope fit and linked maintainer decision: not applicable; fix
    within existing boundaries.
  • CLI and MCP/tool-catalog contract: the output shape is unchanged. The
    observable difference is that a false limitations entry is no longer
    reported for arm64e.v1 selections, and the returned UUID comes from the
    matching dwarfdump row rather than falling back to LC_UUID — the same
    value, with the unfounded uncertainty removed.
  • Provider, bridge, target-format, or platform compatibility: the parsers are
    portable; the tools involved remain macOS-only as before, and the tests need
    no macOS host.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged. Both
    observations are still recorded and a disagreement is still reported.
  • Target selection, authority, upstream behavior, and cleanup details: not
    applicable; no execution, no writes.
  • Generated metadata: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added: src/native/parsers/machoUuid.test.ts (new, 5 tests): the
    arm64e.v1 row now matches; an exact name still matches; arm64e.x1 stays
    unmatched; a genuinely absent row is still reported as absent; two rows of the
    same family are still reported as a conflict rather than silently reduced to
    one.
  • Base reproduction: reverting only the comparison change makes exactly two of
    the five fail — matches a dwarfdump row to an arm64e.v1 selection and
    reports a conflict between two rows of the same family — and restoring it
    makes all five pass. I ran both directions.
  • Remaining proof gaps: this was not reproduced on macOS with real lipo,
    dwarfdump and an arm64e toolchain, because none are available here; the
    regression is at the parser boundary the report identifies, and the issue's
    own reproduction shows the same (arm64e) row. The arm64e.x1 behaviour is
    asserted from the documented tool semantics already recorded in
    NativeMachoInspection.ts, not observed on hardware.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/native/parsers/machoUuid.test.ts — 5 passed;
    2 of the 5 fail when the fix is reverted.
  • npm run test:focused -- src/native/NativeMachoInspection.test.ts — 19
    passed, unchanged by this fix.
  • npx tsc --noEmit — no errors in the changed files.
  • npx oxlint src/native/parsers/ — 0 errors.
  • npx oxfmt <changed files> — applied.

Not run, and not claimed as passing: npm run check:fast (its deps:check
pre-step fails in this environment) and npm run test:acceptance (requires a
build). Expected to be covered by CI.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not required; no macOS host was
    used, which is recorded above as a proof gap.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: parsing captured tool
    output only; no execution, no mutation.

Author readiness

Human owner: @Henglie

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

lipo names an arm64e slice with its pointer-auth ABI version (arm64e.v1),
while dwarfdump reports the CPU-family name for the slice it was asked
about, and the slice tools are already invoked with the version stripped.
Only the row comparison used string equality, so a correct (arm64e) row
never matched an arm64e.v1 selection and successful Evidence carried a
false "no row" limitation.

Compare family names by stripping a trailing pointer-auth version. Other
variants (arm64e.x1) are distinct subtypes and still match only exactly.

Fixes morluto#4195
@Henglie
Henglie marked this pull request as ready for review October 16, 2026 00:06
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The test-only changes appear safe to merge.

Summary

The current PR adds five tests for Mach-O UUID row selection. It changes no production code.

  • UUID tests spell out selected-slice row matching.

Reviews (2) · Last reviewed commit: "Merge origin/main into fix/macho-arm64e-..." · Reviewed by Greptile

Comment thread src/native/parsers/machoUuid.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1c9235e76

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/native/parsers/machoUuid.ts Outdated
Comment on lines +115 to +116
dwarfdumpArchitectureName(architecture) ===
dwarfdumpArchitectureName(selectedArchitecture),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match the family fallback without collapsing row versions

When captured output contains an explicit (arm64e.v2) row but the selected slice is arm64e.v1, normalizing both operands turns that contradictory row into a match. reconcileObservations can then use the other slice's UUID when LC_UUID is absent or malformed, or report a false UUID conflict when it differs. The invocation path already derives the unversioned dwarfdump name in toolArchitectureName; compare the source row against either the exact selection or that derived family name instead of adding a second normalizer that erases version identity.

AGENTS.md reference: AGENTS.md:L25-L27

Useful? React with 👍 / 👎.

it("matches a dwarfdump row to an arm64e.v1 selection", () => {
// lipo names the slice arm64e.v1; dwarfdump reports the CPU-family name.
expect(
reconcile(`UUID: ${validUuid} (arm64e) ${path}\n`, "arm64e.v1"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exercise the family row through the inspection boundary

In the universal arm64e.v1 scenario, this direct parser call bypasses the production selection and reconciliation path. tests/boundary/providers/native/nativeSelectedArchitecture.test.ts:90-157 already exercises that workflow, but line 136 still fabricates an (arm64e.v1) row, so it passes before this fix and does not cover the observed (arm64e) producer output. Drive the family row through that boundary case, retaining module tests only for parser-specific edge cases.

AGENTS.md reference: AGENTS.md:L79-L79

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T03:30:51.535202Z 8fc8cc8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

morluto added a commit that referenced this pull request Oct 16, 2026
Carry the selected slice name and the existing tool owner's dwarfdump spelling separately. Compare observed row labels exactly, preserving explicit ABI versions and uncertainty for missing rows.

Correct the production-boundary fixture and retain wrong-version and mixed-row controls. Real Apple multi-version selection behavior remains unverified.

Refs: #4195, #4288

Co-authored-by: Henglie <[email protected]>
@kaoru0822-kitauji kaoru0822-kitauji added the ci-fix-wip Claimed by the CI-fix track label Oct 16, 2026
Main (2f6b9ec) fixed the same arm64e.v1 dwarfdump row match at the
inspection owner: NativeMachoInspection maps lipo's slice name to the
dwarfdump spelling once, and reconcileMachoUuid matches that mapped
name. Take main's parser and keep this PR's parser coverage on the new
{ name, dwarfdumpName } selection, so the name is not normalized twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Resolved the conflict with main (8fc8cc8). Main's 2f6b9ec, co-authored from this PR, already fixes the arm64e.v1 row match at the inspection owner: NativeMachoInspection maps lipo's slice name to dwarfdump's spelling once and passes { name, dwarfdumpName } to reconcileMachoUuid. I took main's parser so the name isn't normalized twice, and kept this PR's machoUuid.test.ts coverage on the new selection API. That file (5 tests) and nativeSelectedArchitecture.test.ts (18) pass locally. What remains of this PR is parser-level test coverage.

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI after the conflict resolution: the only failures are main's red browser tests, PlaywrightBrowserScenarioProvider ... cancels an active action and still closes the session and browserScenarioProbeLifecycle ... keeps the shared browser scenario provider open. Both fail the same way on main (42fc6c5); the other shards were cancelled after them. Nothing in this PR causes them. It should go green once main's browser cancellation fix (likely #4345) lands.

@kaoru0822-kitauji kaoru0822-kitauji removed the ci-fix-wip Claimed by the CI-fix track label Oct 16, 2026
@Henglie

Henglie commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: upstream commit 2f6b9ec ("fix(native): preserve slice identity when selecting UUID rows") landed the same fix on main and did it better than mine — it derives the dwarfdump family name at the call site and compares the row against that name, so an explicit versioned row from another slice keeps its identity instead of being normalized into a match. My branch now has no changes main does not already carry. Thanks to the reviewers for pointing out the version-collapsing flaw in my normalizer; that was a real bug in this PR.

@Henglie Henglie closed this Oct 16, 2026
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect-macho reports a missing UUID row for a valid arm64e.v1 slice

3 participants