[PR #1629] [MERGED] fix(ghidra): admit carved MIPS ELF with incomplete section tables #4711

Closed
opened 2026-10-31 00:54:15 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1629
Author: @N0zoM1z0
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/mips-carved-section-table-20261010


📝 Commits (2)

  • c7003e0 fix(ghidra): inspect carved MIPS ABI declarations without missing sections
  • b17fbe3 test: share filesystem fixtures and cleanup assertions

📊 Changes

9 files changed (+313 additions, -116 deletions)

View changed files

📝 docs/ghidra-mips.md (+12 -0)
📝 scripts/verify-real-ghidra-mips.mjs (+109 -1)
📝 src/application/BinaryTargetResolver.ts (+7 -1)
📝 src/application/MipsElfAbiFlags.ts (+27 -6)
📝 src/domain/binaryTargetTypes.ts (+3 -1)
📝 src/ghidra/GhidraMipsProfile.ts (+7 -1)
📝 src/ghidra/GhidraProviderClient.ts (+7 -3)
📝 tests/boundary/filesystem/asarStreamingAllocation.test.ts (+46 -64)
📝 tests/boundary/filesystem/mipsAbiFlags.test.ts (+95 -39)

📄 Description

A carved MIPS ELF with intact program headers and a valid PT_MIPS_ABIFLAGS record was refused before Ghidra because its section table extended past EOF. Read all complete captured section headers, retain their declarations, and report unavailable headers as unknown. Valid program-header ABI declarations can then support the existing MIPS32r2/o32 lane.

Carry the missing-section limitation from target resolution into Ghidra Evidence and profile-bound snapshots. If no ABI record is observed, retain unknown and the existing admission failure. Available duplicate, contradictory, malformed or unreadable ABI records and damaged program tables remain errors; extended numbering and unspecified ABI admission are outside this change.

The optional real-Ghidra lane now carves both endian fixtures after independently checking that every program-header payload remains captured. Public CLI/MCP decompilation, actual loaded language/digests, Evidence/snapshot limitations, source-byte preservation and verified process cleanup cover the recovered artifacts. The lane passes caller-selected Ghidra heap controls to its child workflows.

Shared filesystem fixture helpers also remove repeated MIPS setup and ASAR cleanup assertions that pushed the integrated branch over the existing duplication gate. All failure injection, retained-handle checks and retry scenarios remain covered; the CI threshold is unchanged.

Fixes #1619.

Validation:

  • Source-owned Clang/LLD fixture reproduced the original rejection. Six LE/BE whole/partial-table filesystem regressions failed before the fix.
  • npm run test:focused -- tests/boundary/filesystem/mipsAbiFlags.test.ts src/ghidra/GhidraProvider.behavior.test.ts tests/boundary/filesystem/asarStreamingAllocation.test.ts — 86 passed, including conflicting/duplicate/unreadable records in partial tables and missing declarations remaining unknown.
  • Real Ghidra 12.1.4, JDK 21, Clang/LLD 14.0.6 and GNU readelf: complete and carved LE/BE ELF workflows passed through public CLI/stdio MCP; loaded MIPS:LE:32:default / MIPS:BE:32:default; final owned process lineage verified empty. Java heap capped at 512 MiB and runs serialized on one CPU.
  • npm run check:ci — all eight tasks and architecture guards passed; npm run docs:check passed. Focused tests (86), the unchanged duplication gate, static checks and architecture guards passed after the fixture cleanup; documentation checks also passed.

Linux x64. Real-provider verification passed under pinned Node 24.18.0 on c7003e0; the subsequent test-only cleanup leaves all six runtime/verifier source digests unchanged. No target code execution, native macOS/Windows verification or real Hopper/IDA testing. No new tool or ISA/ABI lane.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1629 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/mips-carved-section-table-20261010` --- ### 📝 Commits (2) - [`c7003e0`](https://github.com/morluto/rea/commit/c7003e0297aa5f325fb5d3168374b21aec763437) fix(ghidra): inspect carved MIPS ABI declarations without missing sections - [`b17fbe3`](https://github.com/morluto/rea/commit/b17fbe39cb5c530a9173c28fe2184467b4aecf20) test: share filesystem fixtures and cleanup assertions ### 📊 Changes **9 files changed** (+313 additions, -116 deletions) <details> <summary>View changed files</summary> 📝 `docs/ghidra-mips.md` (+12 -0) 📝 `scripts/verify-real-ghidra-mips.mjs` (+109 -1) 📝 `src/application/BinaryTargetResolver.ts` (+7 -1) 📝 `src/application/MipsElfAbiFlags.ts` (+27 -6) 📝 `src/domain/binaryTargetTypes.ts` (+3 -1) 📝 `src/ghidra/GhidraMipsProfile.ts` (+7 -1) 📝 `src/ghidra/GhidraProviderClient.ts` (+7 -3) 📝 `tests/boundary/filesystem/asarStreamingAllocation.test.ts` (+46 -64) 📝 `tests/boundary/filesystem/mipsAbiFlags.test.ts` (+95 -39) </details> ### 📄 Description A carved MIPS ELF with intact program headers and a valid `PT_MIPS_ABIFLAGS` record was refused before Ghidra because its section table extended past EOF. Read all complete captured section headers, retain their declarations, and report unavailable headers as unknown. Valid program-header ABI declarations can then support the existing MIPS32r2/o32 lane. Carry the missing-section limitation from target resolution into Ghidra Evidence and profile-bound snapshots. If no ABI record is observed, retain unknown and the existing admission failure. Available duplicate, contradictory, malformed or unreadable ABI records and damaged program tables remain errors; extended numbering and unspecified ABI admission are outside this change. The optional real-Ghidra lane now carves both endian fixtures after independently checking that every program-header payload remains captured. Public CLI/MCP decompilation, actual loaded language/digests, Evidence/snapshot limitations, source-byte preservation and verified process cleanup cover the recovered artifacts. The lane passes caller-selected Ghidra heap controls to its child workflows. Shared filesystem fixture helpers also remove repeated MIPS setup and ASAR cleanup assertions that pushed the integrated branch over the existing duplication gate. All failure injection, retained-handle checks and retry scenarios remain covered; the CI threshold is unchanged. Fixes #1619. Validation: - Source-owned Clang/LLD fixture reproduced the original rejection. Six LE/BE whole/partial-table filesystem regressions failed before the fix. - `npm run test:focused -- tests/boundary/filesystem/mipsAbiFlags.test.ts src/ghidra/GhidraProvider.behavior.test.ts tests/boundary/filesystem/asarStreamingAllocation.test.ts` — 86 passed, including conflicting/duplicate/unreadable records in partial tables and missing declarations remaining unknown. - Real Ghidra 12.1.4, JDK 21, Clang/LLD 14.0.6 and GNU readelf: complete and carved LE/BE ELF workflows passed through public CLI/stdio MCP; loaded `MIPS:LE:32:default` / `MIPS:BE:32:default`; final owned process lineage verified empty. Java heap capped at 512 MiB and runs serialized on one CPU. - `npm run check:ci` — all eight tasks and architecture guards passed; `npm run docs:check` passed. Focused tests (86), the unchanged duplication gate, static checks and architecture guards passed after the fixture cleanup; documentation checks also passed. Linux x64. Real-provider verification passed under pinned Node 24.18.0 on c7003e0; the subsequent test-only cleanup leaves all six runtime/verifier source digests unchanged. No target code execution, native macOS/Windows verification or real Hopper/IDA testing. No new tool or ISA/ABI lane. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:54:15 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4711
No description provided.