Repository navigation
feat(ghidra): admit verified MIPS16 shared ELF images - #1991
Conversation
Inspect source load and relocation declarations before admitting the bounded ELF32 o32 MIPS32r2 MIPS16 lane. Pin the endian-matched language and report per-address decoder context without changing the caller-selected bytes. Refuse symbol-relative and additional section relocations whose semantics are outside this verified lane. Add real public CLI/MCP source controls. Refs #1851 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <[email protected]>
Preserve the merged WASM format guidance and existing MIPS ABI coverage. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <[email protected]>
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 303a7fa50d
ℹ️ 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".
| relocationSections.push({ | ||
| type, | ||
| offset: u32(contents.value, position + 16), | ||
| size: u32(contents.value, position + 20), | ||
| entrySize: u32(contents.value, position + 36), |
There was a problem hiding this comment.
Validate relocation section virtual addresses
For an ET_DYN whose SHT_REL entry has the same file offset and size as DT_REL but a conflicting sh_addr, this projection drops sh_addr (at section-header offset 12), so checkSections incorrectly marks the declarations complete and the image can enter the verified shared-image lane. Capture the section address and require it to match the dynamic table address so contradictory source declarations are refused.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
Summary
REA can analyze unchanged ELF32 o32 MIPS32r2 MIPS16 shared images when their complete source declarations fit a verified Ghidra load profile. Mixed MIPS32/MIPS16 instructions retain their per-address decoder context.
Fixes #1851
Problem and expected behavior
The standard MIPS lane refuses ET_DYN and compressed encodings, preventing native investigation of shared ELF artifacts. Admission must establish the source load, relocation and mode semantics rather than edit headers or infer compatibility from the architecture name.
Change and scope
Contract and boundary impact
decoder_context, e.g.[{"register":"ISA_MODE","value":"1","source":"ghidra-program-context"}]. A null value preserves unavailable context; omitted fields remain valid for older captures/providers.docs/public/product-catalog.json), package, or installation impact: one optionalverify:ghidra:mips-sharedpackage script; ignored catalogs regenerate from contracts. No binary, generated catalog or dependency changes. Tools are caller-supplied.Evidence and regression coverage
moderetainsdefault; compressed instructions report ISA_MODE1, while the standard-mode control preserves an observed null. Source-owned local pointer tags survive relocation; snapshot round trips preserve decoder context.For evidence-bearing changes:
Validation performed
npm run test:focused --eight relevant source/boundary files — 152 passed after main integration, including existing MIPS ABI and WASM diagnostics.npm run verify:ghidra:mips-shared— eight real public CLI/MCP controls passed using Ghidra 12.1.4, JDK 21 and GNU cross-binutils 2.40 on Linux x64. Covered four positive and four refused controls, CLI/MCP parity, source symbols/instruction bytes, local pointer tags, snapshot restore, service responsiveness and zero surviving owned descendants.npm run check:fastandnpm run docs:check— passed on the integrated head.npm run check:cipassed the full static gate before the main sync; CI validates the final published head.Compatibility, safety, and release
Review checklist
type(scope): outcome.