Skip to content

refactor(elf): report pointer relocation failures through ParseFailure - #10748

Merged
morluto merged 1 commit into
fix/il2cpp-limit-public-maximumfrom
refactor/elf-pointer-relocation-parse-failure
Nov 15, 2026
Merged

morluto merged 1 commit into
fix/il2cpp-limit-public-maximumfrom
refactor/elf-pointer-relocation-parse-failure

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stacked on #10741 (#10701 merged). The capacity unit that #10741 adds stays a field beside the ParseFailure limit. ElfPointerRelocationFailure, the shared ELF loader-interpretation failure used by IL2CPP, Android JNI and native initializers, extended Error with its own reason vocabulary and a loose optional maximum. It now extends ParseFailureError (format elf-pointer-relocations), so each consumer reads the shared kind and the capacity budget from the ParseFailure limit instead of re-deriving them from reason strings or repeating the budget literal.

Problem and expected behavior

  • IL2CPP forwarded an ELF capacity failure only if (cause.maximum !== undefined), a check that could not fail once the overloads required a maximum.
  • Android JNI mapped reason === "native-index-capacity" to capacity and reason === "malformed-container" to malformed by hand.
  • Native initializers converted an ELF capacity failure into a BinaryResourceFailure with a hard-coded 16 * 1024 * 1024, a second copy of the producer's budget, and the provider had a separate branch for the original class.

Expected: one failure algebra carried by the producer. Public results are unchanged: the only capacity site reachable from initializer scanning is the 16 MiB dynamic-directory allowance, so its reported maximum stays 16777216, now read from the failure.

Change and scope

  • src/native/metadata/ElfPointerRelocations.ts: ElfPointerRelocationFailure extends ParseFailureError<"malformed" | "unsupported" | "limit">. malformed-container is malformed; the two unsupported reasons are unsupported (undecodedContent true only for an unread pointer encoding); native-index-capacity is limit with { name, maximum }. The reason code and message text are kept; the maximum field is removed.
  • src/il2cpp/Il2cppBinaryImage.ts: forwards failure.limit.maximum; the dead maximum !== undefined path is gone.
  • src/native/android/AndroidJniLibrary.ts: maps by kind.
  • src/native/initializers/ElfInitializers.ts: rethrows the limit failure instead of rebuilding it with a copied budget; NativeInitializersProvider.ts reports { boundary: "structure", maximum: failure.limit.maximum }.

Not included: other per-format failure classes; ELF section-table limits.

Contribution scope: ordinary refactor within existing boundaries; not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ElfPointerRelocationFailure (producer). Consumers: IL2CPP binary image, Android JNI, native initializers and their provider. Superseded: the optional maximum field, IL2CPP's dead branch, JNI's reason-string mapping, the initializer's copied 16 MiB literal.

  • Contribution scope fit and linked maintainer decision: W7 part 6 follow-up "ElfPointerRelocationFailure onto ParseFailure".

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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 updated: src/native/metadata/ElfPointerRelocations.test.ts asserts the capacity refusal as a ParseFailure limit (format: "elf-pointer-relocations", limit: { name: "native-index-capacity", maximum: 4096 }) with the same reason and message.

  • Existing consumer coverage passes unchanged: IL2CPP binary linking, Android JNI library(ies), native initializers (filesystem and MCP).

  • Remaining proof gaps: no test drives the initializer path into the 16 MiB dynamic-directory allowance (it needs a >16 MiB dynamic segment); that mapping is source-derived.

  • 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:local -- src/native/metadata/ElfPointerRelocations.test.ts — 24 passed.

  • npm run test:focused -- tests/boundary/filesystem/nativeInitializers.test.ts tests/boundary/il2cpp/il2cppBinaryFile.test.ts tests/boundary/android/androidJniLibrary.test.ts tests/boundary/android/androidJniLibraries.test.ts tests/boundary/mcp/nativeInitializersMcp.test.ts — 5 files, 241 passed.

  • npm run typecheck — passed. npx oxlint on changed files — no errors. node scripts/verify/architecture-guards.mjs — passed.

  • After rebasing onto fix(il2cpp): report the exceeded native-link maximum in the public refusal #10741: npm run test:local -- src/native/metadata/ElfPointerRelocations.test.ts — 24 passed; npm run test:focused -- tests/boundary/il2cpp/il2cppMetadataProvider.test.ts tests/boundary/il2cpp/il2cppBinaryFile.test.ts tests/boundary/filesystem/nativeInitializers.test.ts tests/boundary/android/androidJniLibrary.test.ts tests/boundary/android/androidJniLibraries.test.ts tests/boundary/mcp/nativeInitializersMcp.test.ts — 275 passed; typecheck and oxlint clean.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; internal class shape only.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T02:21:26.516844Z b74eaf8 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.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes appear safe to merge; no actionable issues were found.

Summary

Moves ElfPointerRelocationFailure onto ParseFailureError and updates IL2CPP, Android JNI, and native initializers to consume its shared failure facts.

  • ELF pointer-relocation failures carry one shared kind and capacity limit.

Reviews (1) · Last reviewed commit: "refactor(elf): report pointer relocation..." · Reviewed by Greptile

Base automatically changed from refactor/il2cpp-parse-failure to main November 15, 2026 02:11
@morluto
morluto force-pushed the refactor/elf-pointer-relocation-parse-failure branch from 7ac3bbe to b74eaf8 Compare November 15, 2026 02:20
@morluto
morluto changed the base branch from main to fix/il2cpp-limit-public-maximum November 15, 2026 02:20
@morluto
morluto merged commit 56e952d into fix/il2cpp-limit-public-maximum Nov 15, 2026
50 checks passed
@morluto
morluto deleted the refactor/elf-pointer-relocation-parse-failure branch November 15, 2026 04:33
morluto added a commit that referenced this pull request Nov 15, 2026
…fusal (#10741)

* fix(il2cpp): report the exceeded native-link maximum in the public refusal

* fix(il2cpp): report each native-link budget's maximum in the unit its producer counts

* refactor(elf): report pointer relocation failures through ParseFailure (#10748)
@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant