Skip to content

fix(native): project Mach-O evidence into container file offsets - #812

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/macho-container-evidence-offsets-20261006
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/macho-container-evidence-offsets-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Project Mach-O segment evidence ranges into the containing file, rather than reporting slice-relative offsets as whole-file locations.

Problem and expected behavior

A normal clang/lipo universal executable has an arm64 slice at byte16384. Public NativeMacOSProvider.inspect_macho currently points its __TEXT evidence at byte0 (the FAT header), although the tool-reported segment belongs to that selected slice. The x86_64 selection has the same problem. Evidence locations should identify the actual container bytes. This is an ordinary reproduced bug fix, not a large contract change requiring an issue.

Change and scope

Use the selected architecture offset from the existing lipo observation when projecting segment evidence. Preserve zero-offset thin binaries. When a FAT slice offset is unavailable, omit the affected segment locations and retain an explicit limitation instead of guessing byte0. Raw segment, section, and entry-point offsets stay slice-relative; document that distinction.

Contract and boundary impact

  • Semantic owner and earliest changed stage: native Mach-O evidence-location projection.
  • CLI and MCP/tool-catalog contract: existing schemas and tools unchanged.
  • Provider, bridge, target-format, or platform compatibility: selected Mach-O container evidence only.
  • Evidence, artifact, provenance, or reconstruction contract: corrected whole-container ranges; original tool observations and raw normalized offsets preserved.
  • Process execution, authorization, cleanup, or containment impact: none; tool arguments unchanged.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: five thin/FAT/unknown-offset controls in the existing selected-architecture suite; four new failures on the base source.

  • Base reproduction or other evidence: actual existing Clang/lipo binaries, public target resolution and native provider; both thin controls pass before, both selected universal architectures fail before and pass after.

  • User-visible CLI/MCP output: for the observed arm64 universal fixture, __TEXT evidence begins at16384 instead of0. Raw segments.items[].file_offset remains0.

  • Remaining proof gaps: missing FAT offsets are fixture boundary controls, not claimed native lipo failures. Native producer coverage is macOS only; no Hopper/Ghidra, other OS, or full-provider-matrix claim.

  • 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

  • Related native boundary tests:32passed; base selected-architecture tests4failed/4passed.
  • npm run check:5tasks passed,129 existing warnings and zero errors.
  • npm run check:fast:2tasks passed.
  • npm run docs:check and npm run build:passed.
  • Actual public native provider:four thin/selected-FAT controls passed.
  • Temporary combined-source check with fix(native): retain nm-proven literal export names #807:both regression files20passed, build and all four native controls passed. Then restored and rebuilt the exact signed source. fix(native): retain nm-proven literal export names #807 changes export-name normalization; this PR changes evidence projection.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; unavailable offsets remain explicitly incomplete.
  • Real Hopper/Ghidra, browser, or OS coverage: actual macOS Clang/lipo and native inspection only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no authorization or tool-execution changes; owned native fixture files only.

Review checklist

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

AI-assisted implementation and verification; I reviewed the patch and ran the reported checks.

@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @rudycelekli for the fix and the thorough verification — much appreciated!

@morluto morluto closed this Oct 7, 2026
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 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.

2 participants