Skip to content

fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits - #14243

Merged
morluto merged 8 commits into
mainfrom
fix/limits-owned-refusals
Nov 24, 2026
Merged

morluto merged 8 commits into
mainfrom
fix/limits-owned-refusals

Conversation

@morluto

@morluto morluto commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #14175. Part of #14234.

inspect_il2cpp_metadata --binary refused a real Unity 6 arm64 libil2cpp.so (559,802 relocations) at a fixed 1 GiB ELF pointer-index allowance, and the refusal offered no override. The index now has a per-call control, max_native_index_bytes. The ELF note readers' per-call budgets now report details.limit instead of naming the control only in prose. Two guards keep new in-code refusal limits owned.

Problem and expected behavior

  • IL2CPP: the ELF virtual pointer index reserves 2 KiB per distinct relocated address against IL2CPP_BINARY_BYTES (1 GiB), which is the binary file allowance reused as an index budget. That admits 524,288 addresses. The refusal was typed fixed_ceiling with no override. The index budget is a resource limit (class B), so it should be adjustable and the refusal should name that control.
  • ELF notes / debug-link: max_file_bytes, the decoded section-name budget (also max_file_bytes) and max_entries are per-call parameters, but the refusals carried only remediationAction text and no details.limit.
  • Guards: rea-numeric-limits covers REA_* environment reads and limit-class-guard covers limit error classes. Neither covered in-code ceilings declared through fixedAllowanceOptions (any resource policy could be declared "fixed") or refusals that name their control only in prose.

Change and scope

Contract and boundary impact

  • Semantic owner and earliest changed stage: the IL2CPP domain contract owns the index default and limit, and the loader (elfPointerRelocations) names the caller-selected index failure. The ELF read-budget bounds are shared by schema and refusal.

  • Contribution scope fit and linked maintainer decision: an ordinary fix within existing boundaries, following the per-call parameter pattern. [Design] Should more fixed allowances get a capped, opt-in override? #8434 approved adding overrides for fixed allowances.

  • CLI and MCP/tool-catalog contract: a new optional input field, max_native_index_bytes. The input is rejected without binary_path. Additive details.limit on the ELF notes and debug-link refusals.

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

  • Evidence, artifact, provenance, or reconstruction contract: none. The partial observation is still retained on refusal.

  • Generated metadata: the catalog is regenerated by CI.

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated:
    • tests/boundary/il2cpp/il2cppMetadataProvider.test.ts: max_native_index_bytes: 2048 refuses with details.limit (parameter, effective 2048, default 1 GiB, range) and no fixedAllowance. 1 MiB and the default both link the same pair. The parameter without binary_path is rejected.
    • tests/boundary/filesystem/elfNotes.test.ts and elfDebugLink.test.ts: the max_file_bytes and max_entries refusals project details.limit, and a raised max_entries succeeds.
    • src/domain/native/elfPointerRelocations.test.ts: the caller-selected index limit name.
    • tests/evaluation/fixedCeilingGuard.test.ts: declaration discovery, authored-only counting (including conditionals and trusted helpers), and registry comparison (unregistered, bad class, no reason, pending without issue, stale).
  • Mutation checks (each made a test or guard fail, then was reverted):
    • IL2CPP: dropping the limit-name pass-through in openImageSteps, and not forwarding max_native_index_bytes to linking.
    • ELF: removing the max_entries limit, and wrong max_entries units.
    • Guards: removing a limit from ElfNotesProvider grows the authored-only count, and renaming a registered allowance reports unregistered and stale entries.
  • Base reproduction or other evidence: [Bug] IL2CPP --binary refuses a real Unity 6 arm64 libil2cpp.so: 559,802 relocations exceed the fixed 1 GiB pointer-index allowance #14175 reports the real-build refusal. I did not rerun that public build here, so the real Unity 6 artifact is unverified.
  • Remaining proof gaps: no real IL2CPP build was run. The CLI cli_flag projection was not exercised from a compiled CLI.

Validation performed

  • npx vitest run tests/boundary/il2cpp src/domain/native/elfPointerRelocations.test.ts src/native/metadata/Il2cppContainer.test.ts src/il2cpp: 415 passed
  • npx vitest run ELF notes and debug-link suites (boundary, MCP, src/native/elf, service, finalization): 458 passed, 1 skipped
  • npx vitest run tests/boundary/cli/il2cppElfRelocations.test.ts tests/boundary/cli/il2cppSharedSuffixNames.test.ts src/application/il2cpp/Il2cppMetadataService.test.ts src/application/AnalysisSettings.test.ts tests/conformance: 548 passed
  • npx vitest run tests/evaluation/fixedCeilingGuard.test.ts tests/evaluation/limitClassGuard.test.ts tests/evaluation/numericLimitCheck.test.ts: 30 passed
  • node scripts/verify/fixed-ceilings.mjs: 98 declarations registered, 81 pending, 108 authored-only refusals (baseline)
  • node scripts/verify/architecture-guards.mjs: passed
  • node scripts/verify/rea-numeric-limits.mjs: passed
  • A scoped tsc --noEmit over the changed TypeScript files (temporary tsconfig): no errors
  • npx oxfmt --check and npx oxlint on the changed files: clean, with only pre-existing complexity warnings

Compatibility, safety, and release

  • Breaking changes or migration steps: an IL2CPP refusal at the ELF pointer index now reports reported_limits.boundary: "virtual-pointer-index-bytes" and details.limit for max_native_index_bytes. It no longer reports details.refusal of kind fixed_ceiling. Clients that matched on native-index-capacity for this case should read details.limit. Behaviour is unchanged when the parameter is omitted.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none beyond the catalog.
  • Security, privacy, process, or containment review: a larger value admits more in-process index work. The caller chooses it, and the default is unchanged.

Relation to #14239

The TargetFailure model in #14239 has not landed yet, so these refusals use the existing types (AnalysisResourceConstraintError, an AnalysisParameterLimit limit, fixedAllowanceOptions). #14239 migrates them to its resource kind with details.limit. The details.limit facts added here are the payload that kind carries, so the migration moves them without changing them.

The guards check limit ownership, not reason vocabulary, so they do not overlap with #14239's planned guard against old reason vocabularies. When the migration lands, it should retarget them the same way:

  • fixed-ceilings.mjs: point the declaration helpers at the resource kind's fixed-ceiling constructor. The registry stays keyed by file and allowance.
  • the authored-only count: count resource failures that carry no limit owner.

Removing a construction only lowers the counts, so migration PRs never need to raise a baseline.

…te budgets in details.limit

inspect_il2cpp_metadata accepts max_native_index_bytes (default 1 GiB,
needs binary_path) for the estimated ELF virtual pointer index. The index
refusal now carries its own limit name (virtual-pointer-index-bytes) and a
details.limit naming the parameter, its effective value, default and range,
instead of a fixed ceiling with no override. The binary file allowance and
the loader's fixed capacities are unchanged.

inspect_elf_notes and inspect_elf_debug_link refusals for max_file_bytes,
the decoded section-name budget and max_entries now set details.limit. One
domain-owned bounds object per operation feeds both the schema and the limit.

Two guards keep new in-code refusal limits owned:
- scripts/verify/fixed-ceilings.mjs (run by npm run lint) requires every
  fixedAllowanceOptions, fixedProducerInputAllowance,
  artifactFixedLimitFailure or inline fixedAllowance declaration to be
  listed in fixed-ceiling-registry.json with its class (format, protocol,
  representation, derived, forwarding, or pending with an issue) and reason,
  and fails on stale entries.
- The untyped-budget-refusal architecture guard counts refusals whose only
  recovery is an authored remediationAction, with a shrink-only baseline.

Fixes #14175
Part of #14234

BREAKING CHANGE: an inspect_il2cpp_metadata refusal at the ELF pointer index
reports reported_limits.boundary "virtual-pointer-index-bytes" and
details.limit for max_native_index_bytes, and no longer carries a
details.refusal fixed_ceiling.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T01:44:55.047227Z
We couldn’t complete this review. Comment @codex review to try again.
f6ee9d3 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge, with the previous schema-record finding addressed and no new blocking findings.

Summary

The PR makes the IL2CPP ELF pointer-index allowance adjustable through max_native_index_bytes and adds structured limit details to ELF reader refusals.

  • IL2CPP callers can raise the ELF pointer-index budget for a binary.
  • ELF note and debug-link refusals name the limit that stopped the read.
  • Lint checks that fixed ceilings are registered and refusals name their limits.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["max_native_index_bytes or 1 GiB default"] --> B["IL2CPP binary linking"]
  B --> C["ELF virtual pointer index"]
  C --> D{"Index allowance exceeded?"}
  D -->|No| E["Continue linking"]
  D -->|Yes| F["virtual-pointer-index-bytes failure"]
  F --> G["details.limit names max_native_index_bytes"]
  H["Other fixed loader capacities"] --> I["Existing fixed-ceiling recovery"]
Loading

Reviews (5) · Last reviewed commit: "fix(limits): record the advertised IL2CP..." · Reviewed by Greptile

Comment thread scripts/verify/architecture-guards.mjs Resolved
Comment thread scripts/verify/fixed-ceiling-guard.mjs Resolved
Comment thread scripts/verify/fixed-ceiling-guard.mjs Resolved
…eScript is installed

The architecture guards run before npm ci in CI and must stay
dependency-free, so the AST-based count moves into fixed-ceilings.mjs with
its own shrink-only baseline and --shrink-baselines.
…owance they name

fixedProducerInputAllowance names its allowance in its second argument, and
fixedNativeAllowance forwards its first, so the guard now reads each helper's
allowance argument and checks the callers of both.
Comment thread scripts/verify/fixed-ceilings.mjs Resolved
… removed

reconcileBaselineFile returns delete once no count remains, but the
verifier ignored it and the next run read the file unconditionally, so
--shrink-baselines could not finish. An absent baseline now reads as empty
and shrinking removes the file.
Comment thread src/domain/il2cpp/il2cppMetadata.ts Resolved
@morluto
morluto enabled auto-merge (squash) November 24, 2026 04:33
@morluto
morluto disabled auto-merge November 24, 2026 04:37
@morluto
morluto merged commit 6ab595c into main Nov 24, 2026
54 checks passed
@morluto
morluto deleted the fix/limits-owned-refusals branch November 24, 2026 04:37
vincentkoc added a commit that referenced this pull request Nov 24, 2026
…-20261124

* origin/main: (3854 commits)
  fix(ci): retry recorded crash dependency acquisition without stale index cache (#14076)
  chore(deps): bump rcssmin from 1.2.2 to 1.3.0 in /website (#14229)
  chore(deps): bump markdownify from 1.2.3 to 1.2.4 in /website (#14227)
  ci: compare frozen selections with observed test failures (#14301)
  ci: record affected-test predictions above the live cutoff (#14300)
  ci: wait for static checks before broad PR test shards (#14299)
  ci: validate workflow anchors with actionlint 1.7.12 (#14298)
  ci: measure portable runner time for recorded selection predictions (#14304)
  test(pe): distinguish unsupported DOS input from truncated input (#14302)
  test(go): check build information in a one-directory PE32 fixture (#14303)
  fix(tests): damage Deno PE resource framing the loader-equivalent reader reads
  test(go): expect loader-equivalent PE header facts in the MZ diagnostics (#14293)
  perf(resources): refuse non-ASAR Pickle prefixes without building errors
  perf(artifacts): reuse the streamed XML plist verdict when classifying
  perf(artifacts): decide the FAT header once per classified stream
  test: run repeated CLI formatting capacity pairings in process (#14279)
  fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits (#14243)
  fix(artifacts): report S-record data after the final count (#14260)
  feat(artifacts): report declared DDS, GLB, KTX and KTX2 headers and regions (#14248)
  fix(pe)!: share one loader-equivalent PE header owner across static readers (#14253)
  ...
@morluto morluto added area: domain Domain logic, errors, and pure functions bug Something isn't working labels Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] IL2CPP --binary refuses a real Unity 6 arm64 libil2cpp.so: 559,802 relocations exceed the fixed 1 GiB pointer-index allowance

1 participant