Skip to content

feat(native): admit bounded MIPS ELF analysis through Ghidra - #1

Closed
jaelliot wants to merge 8 commits into
mainfrom
feat/mips-elf-ghidra
Closed

jaelliot wants to merge 8 commits into
mainfrom
feat/mips-elf-ghidra

Conversation

@jaelliot

@jaelliot jaelliot commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Development review checkpoint

Current source head: eeeada5663fcb58e21f9a642bbac50ef70d16310.
Upstream revision incorporated and tested: 81cdafc132c7ba3bd6e12b1169f9e3687025d07b.

The same branch backed upstream morluto/rea#1362, which was merged into upstream main on October 15, 2026. This fork PR remains open as a historical development checkpoint; the source branch has not been changed by this description update.

Diff interpretation: this fork PR still targets the deliberately unchanged fork main at 1ac8389c5c1f75faf8d7f2f3faf2f24febad5fea. Its comparison therefore includes incorporated upstream work. The focused MIPS contribution diff is in upstream morluto#1362, which compares against upstream main. The larger fork diff is not newly authored feature scope.

Contribution boundary

This advances the generic MIPS ELF portion of #718, not the complete firmware roadmap. PSP/Allegrex #1330 and the separate PSP spike in fork #2 remain follow-ons.

The contribution recognizes EM_MIPS and preserves ELF/ABI identity through target parsing, Ghidra profile selection, public schemas, Evidence and snapshots. Initial verified admission remains ELF32 ET_EXEC, explicit o32/MIPS32r2, either byte order, and compatible ABI records. Unsupported variants and missing declarations are not guessed; Hopper/IDA and Windows P0 coverage are not widened.

Source-owned fixtures and verify:ghidra:mips test real public CLI/MCP analysis. GNU readelf is a test-time independent reader, not a new provider. No new MCP tool, paid engine, automatic installer, emulator or game data is introduced.

Upstream synchronization

2b7f9586d4f5aad0b4220de2f8971aac5d1c00ae merges upstream 81cdafc... into the prior tested contribution adf1cda..., preserving both parent histories. The merge had no textual conflicts, but initial run 38022127678 exposed a real TypeScript integration failure.

Upstream's native-Ghidra-tool architecture fallback used .includes(...) on a union of architecture arrays widened by MIPS, making its argument type never. eeeada5 changes that check to equality-based .some(...) membership without casts or changed host support. One regression extends the existing rejection table with a MIPS executable at the Linux x64 decompiler path.

Upstream regular-file identity/stability, snapshot target validation, package/lockfile and architecture guards remain in place. No CI gate, threshold or ignore rule was weakened. Fork-only preparation and verification workflows remain on ci/mips-upstream-sync, outside the contribution source branch.

After hosted validation passed, the actual feature branch was advanced using a non-force update with its expected old head checked. The separate PSP source branch was not changed.

Completed validation of eeeada5

Run 38022307570, job 114125761674, completed successfully. It explicitly checks out eeeada5663fcb58e21f9a642bbac50ef70d16310, not its orchestration commit c36f1e9c8b5b0a0fbdbf845784f86f37f2d0568e.

Gate Result
Locked dependencies and package build PASS; Node 24.18.0 / npm 11.16.0
Actual focused Vitest 130 passed, zero failures/skips, eight suites
check:ci PASS; eight tasks plus upstream architecture guards
Architecture guards PASS across 1,806 source files; repository-design checks, not processor verification
Test discovery PASS; 688 current files assigned exactly once
Documentation/generated contracts PASS
Real Ghidra CLI/MCP, little-endian MIPS PASS
Real Ghidra CLI/MCP, big-endian MIPS PASS
Original bytes and final owned-process cleanup PASS; no live descendants

Only one new test was added in this integration fix. The focused selection now includes the existing installation suite in addition to the seven previously affected suites. Upstream changed its overall test inventory; no suite was deleted by this integration correction.

Real-provider configuration: Linux x64, checksum-verified Ghidra 12.1.4, Temurin 21.0.12.1+1, Clang/LLD 18.1.3, GNU readelf 2.42. Verification covered independent ELF/ABI/symbol facts, observed language/compiler, source hashes, fixed instruction bytes/immediate/branch destination, known global/marker, direct call, Evidence/profile binding, snapshot reopening and equivalent CLI analysis. Neither target was executed; selected decoded properties and pseudocode liveness are not complete semantic proof.

Ordinary PR CI and historical evidence

The source-branch update triggered ordinary PR CI 38022753836, which completed successfully. This status is distinct from the focused real-provider validation above; it is not a claim of new PSP or hardware coverage.

Historical validation remains tied to adf1cda...:

  • Ordinary CI 38002231653: all 19 jobs passed; authoritative merged log reports 6,254 tests passed / 89 skipped, with 689 files passed / 11 skipped (700 files). Previous summaries giving 4,162/2 were incorrect.
  • That run tested fork merge e9b8bfabfdcb2c48057dad1d0299ed3fd779aa4c against the old fork base, not the newly incorporated upstream revision.
  • Focused/static/real-provider run 38002495944 and the contributor's Fedora reproduction also concern adf1cda....

Remaining gates

  • Update contribution branch from a pinned upstream revision without changing main.
  • Repair the observed integration failure and pass focused/static/docs checks.
  • Repeat real Ghidra CLI/MCP verification in both byte orders.
  • Ordinary fork PR CI completed successfully.
  • Matching upstream PR feat(native): admit bounded MIPS ELF analysis through Ghidra morluto/rea#1362 merged on October 15, 2026.

Upstream morluto#1362 is merged. This open fork checkpoint does not close morluto#718, add production PSP support, or merge the PSP experiment.

Retain MIPS ELF identity and interpretation through Evidence and snapshots.
Keep provider admission bounded to ELF32 ET_EXEC o32 MIPS32r2, without
implicitly widening Hopper, IDA or Windows P0 coverage. Add source-owned
fixtures and an optional real-provider verifier; real Ghidra verification
remains pending in this contribution environment.

Refs morluto#718
Reject explicit EF_MIPS_FP64 and EF_MIPS_NAN2008 declarations until their
semantics have a real-provider verification lane. Add PSP PRX/Allegrex,
o64/EABI and floating-point-mode refusal regressions. Document that the
header gate is not a full .MIPS.abiflags check and advance the profile lane
identity to invalidate older interpretation bindings.

Validation: 24 standalone checks against the transpiled production profile
module passed; the two new flag cases failed before this change. Clang 17
and LLD compiled the source-owned fixture for both endian targets. The
complete Vitest/typecheck suite and real Ghidra verification remain pending.

Refs morluto#718; PSP support remains follow-up morluto#1330.
Read bounded ELF32 PT_MIPS_ABIFLAGS and SHT_MIPS_ABIFLAGS records through
the already-open target handle. Preserve declared ABI fields, reject
conflicting/duplicate/truncated records, and keep missing records unknown.
Wire inspection into target resolution before provider selection. Require
compatible declarations for the deliberately narrow Ghidra lane and bind
all ABI fields into profile identity (v3) for snapshot invalidation.

Clang 17 produced eight source-owned fixtures spanning both byte orders
and FPXX/FP32/FP64/soft-float modes with identical ELF header flags. The
new reader and policy distinguish them. 24 focused regression test bodies
passed after TypeScript transpilation using node:test in place of Vitest;
strict isolated TypeScript checking of the reader and target/result types
passed. These are limited checks, not full Vitest/project typechecking or
real-Ghidra verification, which remain pending.

Advances morluto#718. PSP/Allegrex remains morluto#1330 follow-up.
github-actions Bot and others added 3 commits October 9, 2026 21:53
…avior

Keep ELF targets out of Hopper Mach-O preparation and scope existing PE fixture types correctly. Move ABI tests into the filesystem boundary lane, use shared cleanup, add resolver regressions, apply the pinned formatter, and register the real MIPS verifier through the existing package-command pattern. Validated with repository-pinned Node/npm, check:ci, actual focused Vitest, discovery and docs:check. Real Ghidra conformance remains pending.
Cross-check the source-owned fixture with bounded GNU readelf inspection, compare production ELF/ABI interpretation and independent symbol addresses, and verify effective Ghidra language/compiler identity through existing public operations. Add a source-owned fixed-encoding probe for immediate and conditional branch checks plus global/string byte assertions.

Add 16 assertion/producer-boundary regression cases without widening production admission, changing provider contracts, or introducing proprietary dependencies. Local focused suite: 99 passed, one existing root-permission test skipped. Typecheck, lint/module boundaries, formatting and 700-file discovery pass; full hosted checks and real Ghidra verification remain pending for this checkpoint.
…gration

The conflict-free upstream merge failed TypeScript compilation because includes on the union of MIPS-only and other architecture arrays requires never. Use equality-based membership without casts or changing accepted native hosts. Extend the existing native-decompiler rejection table with a MIPS executable at a Linux x64 tool path; retain upstream FAT and unknown-header behavior. Hosted verification follows this commit; no success is claimed yet.
@jaelliot
jaelliot marked this pull request as ready for review October 10, 2026 05:03

jaelliot commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

Closing the historical fork duplicate. Its exact head eeeada566 was merged upstream as morluto#1362. This fork PR does not represent remaining unmerged work. The source branch, original CI, and PR discussion remain available as a record; active PSP follow-ups are separate.

@jaelliot jaelliot closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Integrate IoT firmware analysis tools into REA: research and roadmap

1 participant