Skip to content

feat(apple): resolve joined IPS frames to LC_SYMTAB symbols - #10073

Open
iamcipherdev wants to merge 1 commit into
morluto:mainfrom
iamcipherdev:feat/ips-join-symbol-resolution-2026-11-11
Open

iamcipherdev wants to merge 1 commit into
morluto:mainfrom
iamcipherdev:feat/ips-join-symbol-resolution-2026-11-11

Conversation

@iamcipherdev

Copy link
Copy Markdown
Contributor

Fixes #4297

Summary

A joined .ips frame now reports the containing symbol-table symbol for its static address, the last piece of #4297 the maintainer kept open after #6511 (offline inspection) and #9570 (UUID/architecture join with static_address). The report's own printed symbol names stay recorded claims; the joined frame's symbol is derived from the joined artifact's own LC_SYMTAB.

Problem and expected behavior

inspect_apple_ips with join_path joined frames to a Mach-O slice by LC_UUID and architecture and derived static_address, but stopped there: the analyst still had to run atos by hand to learn which function faulted. For the issue's fixture A, frame 0 should resolve to rea_fixture_fault and frame 1 to main at the static addresses atos resolves to the same functions.

Change and scope

  • New src/native/apple/AppleIpsSymbolTable.ts reads one slice's LC_SYMTAB (nlist/nlist_64 plus string table, reusing the existing readMachoSymtabCommand and machoRuntimeSymbolName) and resolves the nearest preceding N_SECT symbol in the same segment as the static address, the same rule atos applies. DWARF debug info is never consulted.
  • Joined frames gain symbol: { name, runtime_name, address, offset } | null in the join schema; unjoined frames report symbol: null. A slice with no LC_SYMTAB, or an unusable table (out-of-slice bounds, over the 1,048,576-entry ceiling), keeps the join working and records why in join.limitations. Malformed tables fail the symbol step only, never the report.
  • Segment admission in the join is unchanged in behavior, extracted into readSliceSegment so the slice walk stays readable; the report limitation text and docs/apple-ips.md now describe symbol resolution, and the new integers are charged to the integer-text allowance.
  • Not included: DWARF/dSYM debug-info lookup, symbolication of shared-cache images (still unjoined), live OS capture, and running atos or any external tool.

Follow the contribution scope. This is a read-only extension of an existing static local-file inspection; no new provider, target execution, or scope decision is involved. The maintainer kept #4297 open for exactly the join and the function/symbol resolution.

Contract and boundary impact

  • Semantic owner and earliest changed stage: AppleIpsMachOJoin slice identity; the new symbol-table module owns LC_SYMTAB interpretation and its consumers read its parsed facts.
  • Contribution scope fit and linked maintainer decision: existing static inspection; maintainer scope is the [Feature] Inspect Apple .ips crash reports as recorded-crash Evidence #4297 thread itself (morluto: kept open because join and symbol resolution were explicitly outside feat(apple): inspect IPS crash reports #6511).
  • CLI and MCP/tool-catalog contract: inputs unchanged. Joined frame objects gain the nullable symbol member; unjoined frames and no-join reports are unchanged.
  • Provider, bridge, target-format, or platform compatibility: applies to 32- and 64-bit Mach-O slices with LC_SYMTAB; FAT containers resolve per slice. No binary linking or Ghidra seeds.
  • Evidence, artifact, provenance, or reconstruction contract: symbol-table names stay source facts with runtime spellings derived; a missing/unusable table stays visible as a join limitation, never a silent empty symbol.
  • Target selection, authority, upstream behavior, and cleanup details: reads only the caller-selected local files through the existing stable artifact reader; no new lifecycle path.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none; CI generates catalogs.

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 or updated: 4 new tests in tests/boundary/filesystem/appleIpsJoin.test.ts (64-bit resolution incl. offset and runtime name, nearest-preceding symbol for an inlined frame, no-LC_SYMTAB limitation, malformed-table limitation, 32-bit slice) plus updated exact-shape expectations for joined/unjoined frames; domain limitation text updated.
  • Base reproduction or other evidence: on unmodified main (30f96aef), the new/updated tests fail exactly as expected — 6 failed, 28 passed — because joined frames carry no symbol member there. On this branch all 34 pass.
  • User-visible CLI/MCP output: joined frame 0 for the fixture now reports (from the boundary test's exact expectation):
    { "static_address": { "decimal": "4294968120", "hex": "0x100000338" },
      "symbol": { "name": "_rea_fixture_fault", "runtime_name": "rea_fixture_fault",
        "address": { "decimal": "4294968108", "hex": "0x10000032c" },
        "offset": { "decimal": "12", "hex": "0xc" } } }
    Frame 1 resolves to _main at offset 40; a frame with no symbol-table entry of its own resolves to the nearest preceding symbol (_main, offset 140).
  • Remaining proof gaps: synthetic Mach-O fixtures only — no real Unity/macOS fixture binary, no real dSYM round trip, and no live macOS capture. DWARF lookup remains out of scope and is stated in the docs.

Boundary regressions covered: parser/admission (symbol-table bounds, truncated command, out-of-slice tables), malformed-input and capacity (entry ceiling, name-length cap). No lifecycle stage is added, so no lifecycle regressions apply.

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 -- tests/boundary/filesystem/appleIpsJoin.test.ts — 34 passed (30 existing + 4 new).
  • npm run test:focused -- tests/boundary/filesystem/appleIps.test.ts tests/acceptance/appleIpsCli.test.ts tests/acceptance/appleIpsJoinFailureCli.test.ts tests/boundary/mcp/appleIpsMcp.test.ts src/domain/native/appleIps.test.ts src/native/apple/AppleIpsParser.test.ts src/native/apple/AppleIpsProvider.test.ts src/application/binaryDiagnostics/AppleIpsService.test.ts — 8 files, 99 passed.
  • npm run check:fast — typecheck and lint passed (only the 2 pre-existing warnings remain).
  • npm run verify:test-discovery — all 3385 test files discovered exactly once.
  • npm run docs:check — 9 passed.
  • Base check: new/updated tests on unmodified main — 6 failed, 28 passed, as expected.

Compatibility, safety, and release

  • Breaking changes or migration steps: none intended. The join frame schema gains one nullable member; consumers that exhaustively match frame keys will see it.
  • Real Hopper/Ghidra, browser, or OS coverage: no real macOS fixture or dSYM was available on this Linux host; verification is synthetic fixtures plus the existing CLI/MCP acceptance paths.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: local read-only parsing; symbol names are retained only in the caller's Evidence, bounded by the join read budget and the integer-text allowance.

Author readiness

Human owner: @iamcipherdev

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

Joined frames now report the containing symbol-table symbol for their
static address (table name, runtime spelling, symbol address, byte
offset) when the joined Mach-O slice carries LC_SYMTAB. Slices without
a usable table report symbol null with a join limitation instead.

Closes morluto#4297
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T09:18:09.287373Z 8599860 PR opened
ℹ️ 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.

@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: 8599860b16

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const start = strtab + strx;
const end = bytes.indexOf(0, start);
if (end === -1 || end >= strtab + strsize) return null;
if (end - start > MAX_SYMBOL_NAME_BYTES) return null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve unknowns for overlong symbol names

When a valid N_SECT name is longer than 1,024 bytes, symbolName returns null and readAppleIpsJoinSymbols silently drops the entry. Frames between that symbol and the next retained one then inherit an older preceding symbol in the same segment, producing a false name and offset instead of an unknown result; surface this per-entry incompleteness or prevent lookup from crossing the skipped entry.

AGENTS.md reference: AGENTS.md:L97-L97

Useful? React with 👍 / 👎.

low = middle + 1;
}
}
for (let index = low - 1; index >= 0; index -= 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound symbol lookup to the target segment

For a joined frame whose derived address is in a segment with no symbols, such as __DATA after all __TEXT symbols, this global backward scan examines every lower-valued symbol for every frame. The admitted 1,048,576-entry symbol cap and 65,536-frame cap allow about 68 billion iterations on a bounded but crafted join, making inspection effectively hang; start the search at the segment's address range or index symbols by segment.

AGENTS.md reference: AGENTS.md:L57-L58

Useful? React with 👍 / 👎.

@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request labels Nov 22, 2026

This branch has not been deployed

No deployments
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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Inspect Apple .ips crash reports as recorded-crash Evidence

2 participants