Skip to content

fix(native): retain selected Mach-O slice identity - #7940

Merged
morluto merged 1 commit into
mainfrom
codex/macho-selected-row-7350
Oct 28, 2026
Merged

morluto merged 1 commit into
mainfrom
codex/macho-selected-row-7350

Conversation

@morluto

@morluto morluto commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #7350. A universal Mach-O with ARM64 V8 before ARM64 ALL could return the V8 container offset for commands that inspected ALL, so segment Evidence pointed into a different slice.

Problem and expected behavior

Apple lipo can name both slices arm64. The selector ranked the correct subtype but returned only its name; a later lookup picked the first same-named record. The selected record now remains authoritative through offset projection. Tool arguments use the selected subtype spelling, and indistinguishable tool selectors receive an explicit refusal rather than a guessed offset.

Change and scope

The shared Mach-O selection owner returns the selected lipo record instead of reducing it to a display name. Related binary FAT selection and metadata paths already retain their selected slice and do not repeat this name lookup. No target code executes.

Contract and boundary impact

  • Semantic owner and earliest changed stage: lipo architecture selection in native Mach-O inspection.
  • Contribution scope fit and linked maintainer decision: existing read-only static inspection; no new target authority.
  • CLI and MCP/tool-catalog contract: unchanged schema; ambiguous selectors now return a typed output refusal.
  • Provider, bridge, target-format, or platform compatibility: Apple native tools on macOS; exact selected subtype remains subject to available tool spellings.
  • Evidence, artifact, provenance, or reconstruction contract: selected slice base and derived segment locations identify the inspected bytes; all inventory rows remain present.
  • Target selection, authority, upstream behavior, and cleanup details: no changes to process ownership or cleanup.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.

Evidence and regression coverage

Executed macOS arm64 public CLI inspection with real Apple tools on three synthetic inert objects: V8-first and ALL-first FAT tables each returned selected base 32768 and segment range [32952, 32968); the thin ALL control returned base 0 and range [184, 200). Both FAT inventory ranges remained present. Source tests cover same-named records, subtype-specific tool spelling, ambiguous selector refusal, and existing architecture selection controls.

Validation performed

  • npm run test:local -- src/native/NativeMachoInspection.test.ts src/native/AppleMachoSelection.test.ts — 97 passed.
  • npm run test:focused -- tests/acceptance/machoSelectedSliceCli.test.ts — 1 passed, real macOS arm64 Apple tools and public CLI.
  • npm run check:fast — passed.
  • git diff --cached --check — passed before commit.

Compatibility, safety, and release

Ambiguous selectors that previously risked wrong coordinates now fail explicitly. MCP, other hosts and Apple-tool versions were not tested. Fixture Mach-O objects are synthetic and are not executed.

Author readiness

Human owner: @morluto

  • 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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable introduced issues were found.

Summary

Retains the selected Mach-O slice record instead of looking it up again by name.

  • Mach-O inspection keeps each selected slice tied to its own offset.

Review was source-based; tests and Apple tools were not run here. GitHub authentication was unavailable, so supersession and existing review threads could not be checked.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[lipo records] --> B[Select one record]
  B --> C[Derive tool spelling]
  C --> D{Selector collision?}
  D -->|Yes| E[Return typed refusal]
  D -->|No| F[Run slice commands]
  B --> G[Retain selected offset]
  F --> H[Normalize observations]
  G --> I[Project file locations]
  H --> I
Loading

Reviews (1) · Last reviewed commit: "fix(native): retain selected Mach-O slic..." · Reviewed by Greptile

@morluto
morluto marked this pull request as ready for review October 28, 2026 22:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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 ✅ Completed 2026-10-28T22:24:31.619131Z f5131c5 Draft marked ready
ℹ️ 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
morluto merged commit 2129c17 into main Oct 28, 2026
42 of 45 checks passed
@morluto
morluto deleted the codex/macho-selected-row-7350 branch October 28, 2026 23:57
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 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 maps the selected ARM64 slice to a different same-named FAT row

1 participant