Repository navigation
fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits - #14243
Conversation
…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.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The PR appears safe to merge, with the previous schema-record finding addressed and no new blocking findings. SummaryThe PR makes the IL2CPP ELF pointer-index allowance adjustable through
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"]
Reviews (5) · Last reviewed commit: "fix(limits): record the advertised IL2CP..." · Reviewed by Greptile |
…sals # Conflicts: # docs/il2cpp-metadata.md
…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.
…sals # Conflicts: # docs/il2cpp-metadata.md
… 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.
…-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) ...
Summary
Fixes #14175. Part of #14234.
inspect_il2cpp_metadata --binaryrefused a real Unity 6 arm64libil2cpp.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 reportdetails.limitinstead of naming the control only in prose. Two guards keep new in-code refusal limits owned.Problem and expected behavior
IL2CPP_BINARY_BYTES(1 GiB), which is the binary file allowance reused as an index budget. That admits 524,288 addresses. The refusal was typedfixed_ceilingwith no override. The index budget is a resource limit (class B), so it should be adjustable and the refusal should name that control.max_file_bytes, the decoded section-name budget (alsomax_file_bytes) andmax_entriesare per-call parameters, but the refusals carried onlyremediationActiontext and nodetails.limit.rea-numeric-limitscoversREA_*environment reads andlimit-class-guardcovers limit error classes. Neither covered in-code ceilings declared throughfixedAllowanceOptions(any resource policy could be declared "fixed") or refusals that name their control only in prose.Change and scope
max_native_index_bytes(optional; positive safe integer; default 1 GiB; needsbinary_path; CLI--max-native-index-bytes). Its owner issrc/domain/il2cpp/il2cppMetadata.ts(DEFAULT_IL2CPP_NATIVE_INDEX_BYTES,il2cppNativeIndexLimit). The maximum isNumber.MAX_SAFE_INTEGER, the same asmax_metadata_representation_bytes: the accounting is exact, and host heap stays an independent constraint.readElfPointerValuesStepstags its caller-selected index refusal with limit namevirtual-pointer-index-bytes, and the IL2CPP failure type keeps that name. The provider maps exactly that name todetails.limit. The loader's fixed capacities (APS2 16 MiB, retained 65,536 writes, unresolved overlay) keepnative-index-capacityand their fixed-ceiling recovery. The JNI consumer is unchanged.src/domain/native/elfReadBudgets.tsholds one bounds object per operation (ELF_NOTES_READ_BUDGETS,ELF_DEBUG_LINK_READ_BUDGETS). The bounds feed both the zod schema andelfReadBudgetLimit, so the reported range is the range the next call accepts.scripts/verify/fixed-ceilings.mjs, run bynpm run lint. EveryfixedAllowanceOptions,fixedProducerInputAllowance,artifactFixedLimitFailureor inlinefixedAllowance: {…}declaration must appear inscripts/verify/fixed-ceiling-registry.jsonunder its file and allowance text. Each entry has a class (format,protocol,representation,derived,forwarding, orpendingplus an issue) and a reason. The guard fails on unregistered declarations and on stale entries. It uses an AST, not a numeric regex. Today it registers 98 declarations: 3 protocol, 3 representation, 2 derived, 9 forwarding and 81 pending, tracked in [Feature] Give native readers' fixed structural, text and inventory allowances a control or a stated fixed reason #14235, [Feature] Give archive and container readers' fixed representation allowances a per-call control #14236 and [Feature] Let fixed producer output and capture allowances use producer_limits #14237.scripts/verify/untyped-budget-refusal-baseline.json(--shrink-baselineslowers it). It lives in lint, not the architecture guards, because it parses TypeScript and the architecture guards run beforenpm ci. It countsAnalysisResourceConstraintErrorandparseLimitConstraintoption literals, including each conditional branch, that setremediationActionwithoutlimit,fixedAllowanceormeasuredExhaustion. The count is 108 sites in 82 files after this PR, down from 114 sites in 84 files.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 withoutbinary_path. Additivedetails.limiton 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/boundary/il2cpp/il2cppMetadataProvider.test.ts:max_native_index_bytes: 2048refuses withdetails.limit(parameter, effective 2048, default 1 GiB, range) and nofixedAllowance. 1 MiB and the default both link the same pair. The parameter withoutbinary_pathis rejected.tests/boundary/filesystem/elfNotes.test.tsandelfDebugLink.test.ts: themax_file_bytesandmax_entriesrefusals projectdetails.limit, and a raisedmax_entriessucceeds.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).openImageSteps, and not forwardingmax_native_index_bytesto linking.max_entrieslimit, and wrongmax_entriesunits.limitfromElfNotesProvidergrows the authored-only count, and renaming a registered allowance reports unregistered and stale entries.cli_flagprojection 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 passednpx vitest runELF notes and debug-link suites (boundary, MCP,src/native/elf, service, finalization): 458 passed, 1 skippednpx 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 passednpx vitest run tests/evaluation/fixedCeilingGuard.test.ts tests/evaluation/limitClassGuard.test.ts tests/evaluation/numericLimitCheck.test.ts: 30 passednode scripts/verify/fixed-ceilings.mjs: 98 declarations registered, 81 pending, 108 authored-only refusals (baseline)node scripts/verify/architecture-guards.mjs: passednode scripts/verify/rea-numeric-limits.mjs: passedtsc --noEmitover the changed TypeScript files (temporary tsconfig): no errorsnpx oxfmt --checkandnpx oxlinton the changed files: clean, with only pre-existing complexity warningsCompatibility, safety, and release
reported_limits.boundary: "virtual-pointer-index-bytes"anddetails.limitformax_native_index_bytes. It no longer reportsdetails.refusalof kindfixed_ceiling. Clients that matched onnative-index-capacityfor this case should readdetails.limit. Behaviour is unchanged when the parameter is omitted.Relation to #14239
The
TargetFailuremodel in #14239 has not landed yet, so these refusals use the existing types (AnalysisResourceConstraintError, anAnalysisParameterLimitlimit,fixedAllowanceOptions). #14239 migrates them to itsresourcekind withdetails.limit. Thedetails.limitfacts 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 theresourcekind's fixed-ceiling constructor. The registry stays keyed by file and allowance.resourcefailures that carry no limit owner.Removing a construction only lowers the counts, so migration PRs never need to raise a baseline.