rea/docs
The one -Niu 0baad58e60
feat(ghidra): admit RISC-V ELF analysis through a pinned generic lane (#2151)
* feat(ghidra): admit RISC-V ELF analysis through a pinned generic lane

Refs #2063.

Recognize `EM_RISCV` (243) as a provider-neutral family that carries its own ELF
facts, and bound the first Ghidra lane to little-endian `ET_EXEC` images that
declare the double-float ABI, pinned to `RISCV:LE:32:default` or
`RISCV:LE:64:default` with the `gcc` compiler specification.

Ghidra 12.1.4 is not reliable without the pin: its `riscv.opinion` pins
`variant="default"` for the 64-bit constraint and leaves the 32-bit constraint
with the comment that the loader "must choose between 'default' and 'AndeStar'
variants". Measured on the installed release tree, a source-owned generic RV32
ELF with no Andes declaration imports as `RISCV:LE:32:AndeStar_v5:gcc`, while
RV64 resolves to `RISCV:LE:64:default:gcc`. The lane therefore states the
language per width and refuses any caller-selected processor outside it instead
of inheriting the header guess.

Refusals name the declaration rather than falling back to a guessed profile:
big-endian images (Ghidra 12.1.4 ships no big-endian RISC-V language),
non-`ET_EXEC` images, `EF_RISCV_RVE`, `EF_RISCV_TSO`, and every float ABI other
than double, which the pinned generic compiler specifications model. The raw
e_flags bits stay in Evidence as declarations, not as instruction semantics.

Family recognition now has one owner for the ELF-metadata families:
`ELF_METADATA_ARCHITECTURES`, `isElfMetadataArchitecture`, and
`HeaderArchitecture` replace ten `Exclude<BinaryArchitecture, "mips">` sites that
would each have needed a second hand-edited member. `ghidraPinnedLanguage` is
that owner for the import commitment: the session readback previously re-derived
only the MIPS pin, so a profile committing any second pinned language failed with
a language-mismatch error before the bridge started.

Hopper and IDA refuse RISC-V by name, matching the MIPS wording. Caller-supplied
raw-binary entry keeps its existing four-family list; this lane is ELF-header
admission only.

Verification on macOS 15.7.7 arm64, Node 24.18.0, Ghidra 12.1.4 PUBLIC and JDK
21.0.12.1, with the host decompiler built from the release sources for
`os/mac_arm_64`: `npm run check` passes; `npm run test:fast` passes 396 test
files; `npm run verify:test-discovery` discovers all 917 test files exactly once.
Source-owned RV32 and RV64 double-float `ET_EXEC` fixtures complete
`rea analyze --provider ghidra` and `rea decompile rea_riscv_entry`, committing
`RISCV:LE:32:default` and `RISCV:LE:64:default` with `language_selection:
provider-pinned-v1`; the soft-float RV64 shape is refused with the named
float-ABI reason, and the full refusal matrix including the RV32 and
width-mismatch shapes is covered by unit tests. No `verify:ghidra:riscv` lane
script is included in this change; the runs above were performed manually against
the installed engine. Fork pull requests receive no CI check runs, so the
real-provider scope above is the evidence available for review.

* fix(ghidra): bound the RISC-V lane by declared flags and document it

Address review feedback on #2151.

`e_flags` bits outside `EF_RISCV_RVC | EF_RISCV_FLOAT_ABI` are now refused with
the offending value named, so a reserved or newer producer declaration cannot
enter the verified generic lane by falling through the RVE, TSO and float-ABI
checks.

Admission reads `e_type` only, so the refusal text no longer calls `ET_EXEC`
static: a fixed-address declaration does not establish static linkage, and
`PT_INTERP` and dynamic dependencies are not inspected. The session records that
boundary as a limitation rather than inferring a load model.

Add `docs/ghidra-riscv.md` in the shape of the MIPS lane guide (admission
boundary, refusal table, why the language is pinned per class, Evidence fields,
and what the fixtures do not establish), and correct
`docs/firmware-analysis.md`, which still told users that MIPS and RISC-V
decompilation had not been added.

Verification after the change: `npm run check` and `npm run docs:check` pass; the
RISC-V module tests pass (17 lane cases plus 9 parser cases); on Ghidra 12.1.4
with JDK 21.0.12.1 the RV32 and RV64 double-float fixtures still analyze and
decompile with `RISCV:LE:32:default` / `RISCV:LE:64:default` and
`language_selection: provider-pinned-v1`, the soft-float fixture is still refused
by name, and the new linkage limitation appears in the emitted Evidence.

* fix(ghidra): align RISC-V pinning with admission

Reuse the complete lane admission boundary when selecting a language, retain unsigned unsupported flag bits in diagnostics, and derive float ABI metadata from the source declaration.

* test(ghidra): verify RISC-V CLI and MCP workflows

Build source-owned RV32/RV64 fixtures with Clang and LLD, establish independent ELF and symbol facts with LLVM readelf, and verify real provider evidence, instruction bytes, calls, decompilation, schema projections, snapshot replay, refusal diagnostics, source immutability and cleanup.

Verified on macOS ARM64 with Ghidra 12.1.4, JDK 21 and LLVM/LLD 23.1.2. Dynamic linkage, big-endian, Andes and RVE/TSO workflows remain unverified; ISA attributes are not inspected.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-13 00:11:35 +08:00
..
.vitepress docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
assets docs: keep license sections text-only 2026-10-10 00:09:46 +08:00
releases chore(main): release rea-agents 6.4.0 (#1399) 2026-10-11 11:57:29 +08:00
adb-device-analysis.md fix(adb): preserve directory identities and share byte capture 2026-10-12 13:06:51 +08:00
android-analysis.md fix(android): preserve decoded values and duplicate class inventories 2026-10-12 06:29:13 +08:00
apktool-resource-analysis.md fix(apktool): run Windows batch launchers through cmd.exe (#1777) 2026-10-11 17:16:48 +08:00
apple-application-analysis.md fix(mobile): bound framework conventions to path segments (#1506) 2026-10-10 21:42:03 +08:00
architecture.mermaid feat(analysis): add opt-in retained inventory and WASM views (#2122) 2026-10-12 21:17:52 +08:00
binary-diagnostics.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
browser-observation.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
browser-scenario-contract.md fix(browser): preserve body API provenance through script export 2026-10-12 14:12:19 +08:00
cli.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
client-configuration.md feat(clients): register Qoder CLI during setup (#1572) 2026-10-12 22:55:55 +08:00
client-verification.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
electron-observation.md fix(electron): support packaged app.asar pages and rewritten unpacked companions (#1400) 2026-10-10 23:01:54 +08:00
error-contract.schema.json feat(evm): inspect offline bytecode interfaces through EVMole (#1051) 2026-10-08 15:32:05 +08:00
evm-bytecode.md fix(build): make catalogs and packaged skills generated outputs (#1086) 2026-10-08 22:43:51 +08:00
firmware-analysis.md feat(ghidra): admit RISC-V ELF analysis through a pinned generic lane (#2151) 2026-10-13 00:11:35 +08:00
flutter-analysis.md feat(flutter): identify Dart snapshot builds and inspect AOT payloads by pure APK parsing (#1582) 2026-10-12 22:35:55 +08:00
frida-instrumentation.md feat: add Frida instrumentation support (#1359) 2026-10-12 22:01:58 +08:00
ghidra-dos.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
ghidra-mips.md test(ghidra): require pending multi-HI16 coverage in the real MIPS relocatable lane (#1974) 2026-10-12 08:42:08 +08:00
ghidra-nativeaot.md feat(ghidra): inspect NativeAOT PE metadata read-only 2026-10-11 10:31:49 +08:00
ghidra-provider.md feat(ghidra): inspect NativeAOT PE metadata read-only 2026-10-11 10:31:49 +08:00
ghidra-psp.md feat(ghidra): admit bounded PSP ELF through installed Allegrex (#1599) 2026-10-11 19:47:33 +08:00
ghidra-riscv.md feat(ghidra): admit RISC-V ELF analysis through a pinned generic lane (#2151) 2026-10-13 00:11:35 +08:00
go-binaries.md feat(go): inspect embedded binary build metadata (#1363) 2026-10-12 11:34:02 +08:00
harmony-analysis.md feat(harmony): project HarmonyOS package inventory evidence (#1447) 2026-10-11 20:09:21 +08:00
ida-provider.md fix(process): return private runtime ownership at allocation 2026-10-12 16:30:53 +08:00
index.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
installation.md feat(clients): register Qoder CLI during setup (#1572) 2026-10-12 22:55:55 +08:00
javascript-application-graph.md docs(contracts)!: explain canonical URL and skill metadata ownership 2026-10-10 02:49:46 +08:00
javascript-application-workflows.md docs: correct stale logging, Ghidra host, and example path statements (#1420) 2026-10-10 21:29:31 +08:00
javascript-artifact-reconstruction.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
javascript-recovery.md feat(javascript): recover code-split bundles from multiple inputs (#1686) 2026-10-11 18:39:49 +08:00
javascript-runtime-observation.md fix(runtime)!: preserve unknown debugger attachment state 2026-10-12 12:37:00 +08:00
javascript-runtime-reconciliation.md fix(tools)!: simplify direct invocation and harden boundary contracts (#555) 2026-10-05 20:16:44 +08:00
jeb-analysis.md feat(jeb): add JEB engine provider over its MCP interface (#1536) 2026-10-10 23:03:27 +08:00
managed-code-analysis.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
mcp-contracts.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
mcp-prompts.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
migration-6.2.md docs: correct MCP error and capture import guidance 2026-10-10 05:41:52 +08:00
native-investigation.md docs: preserve the native guide title anchor (#2224) 2026-10-12 23:09:11 +08:00
process-capture.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
raw-binary.md feat(ghidra): apply validated analyzer overrides before analysis 2026-10-12 03:49:31 +08:00
reconstruction-obligation-ledgers.md refactor: return complete analysis results inline 2026-09-29 08:07:24 +08:00
reconstruction-readiness.md fix(tools)!: simplify direct invocation and harden boundary contracts (#555) 2026-10-05 20:16:44 +08:00
recorded-crashes.md feat(native): inspect recorded crashes through pwntools and pwndbg (#1054) 2026-10-08 16:50:31 +08:00
releasing.md fix(release): avoid duplicated contributor thanks 2026-10-11 11:49:49 +08:00
roadmap.md docs: remove retired architecture and migration artifacts 2026-10-10 05:41:45 +08:00
testing.md feat(ghidra): admit RISC-V ELF analysis through a pinned generic lane (#2151) 2026-10-13 00:11:35 +08:00
tool-design.md fix(analysis): preserve relationship coverage across evidence and replay 2026-10-12 05:57:35 +08:00
user-visible-errors.csv fix(scripts, install): honor test:fast "without build" promise and orient Node.js engine mismatches (#2026) 2026-10-12 13:54:57 +08:00
wasm-artifacts.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00
web-network-captures.md test: strengthen public input and module lookup controls 2026-10-12 11:59:23 +08:00
web-runtime.md fix(browser): treat module-import initiator positions as script positions 2026-10-08 16:44:25 +00:00
web-source-location.md fix(bun): report the real runtime and enforce worker memory budgets on Windows (#1730) 2026-10-11 19:20:00 +08:00
website-module-trace.md feat(browser): trace captured website module imports (#879) 2026-10-07 14:59:52 +08:00
website-script-export.md fix(browser): preserve body API provenance through script export 2026-10-12 14:12:19 +08:00
windows-ghidra-p0.md docs: correct drift and reorganize English guides (#2207) 2026-10-12 22:14:25 +08:00