Repository navigation
feat(domain): classify 64-bit PowerPC ELF (EM_PPC64) in the powerpc family - #12089
Conversation
An ELF with e_machine 21 was refused as "unsupported ELF architecture" before any provider was consulted, so every entry point answered a 64-bit PowerPC file with the generic file-format refusal. The header reader now places EM_PPC64 in the powerpc family and keeps its class, byte order, e_type and e_flags as it does for EM_PPC. No provider lane admits these files: the Ghidra PowerPC gate already refuses ELF64 by naming PPC64, and Hopper, IDA and Kuna decline the family. Static ELF readers keep the name ppc64 for the machine. Refs morluto#12085.
Static readers report a 64-bit PowerPC ELF as ppc64, and the Evidence subject of those reports had no architecture because the name mapped to no family. With EM_PPC64 classified as powerpc, the subject now carries that family, as it does for ppc. The Go verifier and the Go and Rust guides state the new mapping, and the boundary test keeps an unknown machine (s390) to show that unrecognized names still map to no family. Refs morluto#12085.
Codex Review Summary: ✅ CompletedThis 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: bbd7f7f661
ℹ️ 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".
[Medium impact] No code blockers were found; the draft should remain pending the maintainer decision already noted by Davmunrey. SummaryRecognizes ELF64
Davmunrey keeps this PR in draft pending the family-scope decision in #12085. No superseding change was found in the available Git history. This review checked source; tests were not rerun. Reviews (2) · Last reviewed commit: "fix(domain): classify EM_PPC64 only for ..." · Reviewed by Greptile |
This reverts commit bbd7f7f. Evidence saved before the mapping carries no subject architecture for a ppc64 report. Views over those records compare the saved subject with the family the reader name maps to, so the mapping made them refuse records they accepted before. Nothing in this branch produces Evidence that needs the family, so the mapping can wait for a provider lane. Refs morluto#12085.
Classifying machine 21 by number alone had two effects beyond target resolution. An ELF32 big-endian ET_EXEC header that claims EM_PPC64 became a powerpc target with class 32, which the 32-bit Ghidra lane admits because it sees only class, byte order, type and flags. And every static reader that maps a machine to a family started to put powerpc in its Evidence subject, which changes what views expect from records saved earlier. elfArchitecture now takes the ELF class and names the family for machine 21 only when the caller commits ELF64. Header admission passes the class. Readers that pass only a machine keep the machine unclassified, so their reports, reader names and Evidence subjects are as they were. Refs morluto#12085.
#14) Adds morluto/rea#12089 and morluto/rea#12091 to the REA list and updates the in-review line.
…ane (#12517) * feat(ghidra): admit ELFv2 PPC64 executables through a Power ISA 3.0 lane An EM_PPC64 ELF has been classified in the powerpc family since #12089, but the Ghidra lane still refused every ELF64 file. It now admits ELF64 ET_EXEC files that declare the ELFv2 ABI, little or big endian, and imports them with PowerPC:LE:64:A2ALT or PowerPC:BE:64:A2ALT by byte order. Ghidra's 64-bit "default" languages decode the G2-era instruction set and stop at the first VSX instruction in POWER8 or POWER9 code; the A2ALT languages are Power ISA 3.0 and decode it. The ELF loader selects A2ALT today, and the lane passes it explicitly and records it as provider-pinned. ELFv1 (.opd function descriptors), an undeclared ABI, other e_flags bits, ET_DYN and ET_REL are refused with their own reasons. The 32-bit lane is unchanged. npm run verify:ghidra:ppc64 builds a source-owned ELFv2 fixture in both byte orders and checks it against GNU readelf and real Ghidra through MCP and the CLI: the bound language, fixed instruction bytes including a VSX xxlor, the global-entry thunk to each function's local entry, direct calls, snapshot identity, and a shared object refused before Ghidra starts. Refs #12085 * fix(ghidra): supervise PPC64 verifier compiler and CLI processes Timeouts on bare execFile stop only the direct child, so a linker can outlive Clang and disappear from the parent-tree cleanup check. Launch those commands through the shared command owner, pass that runner into the PPC64 fixture builder, and close the owner before the lineage check. A failed close stays registered for retry and the diagnostic workspace is retained. * docs(ghidra): record the PPC64 ELFv2 Power ISA 3.0 lane Add the feature specification, plan, and tasks for the lane, and index them with the other feature records. * fix(ghidra): finish shared PowerPC verifier command ownership --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: morluto <[email protected]>
Summary
REA refused every ELF with
e_machine = 21(EM_PPC64) before any provider was consulted, with the genericfile_format_rejectedconstraint. This classifies an ELF64EM_PPC64header in the existingpowerpcfamily at target resolution. It is the classification step proposed in #12085 and adds no provider lane: a 64-bit PowerPC file now reaches provider selection and is declined there with reasons that name PPC64 or the family.Refs #12085. The Ghidra lane is not part of this PR.
The scope question in #12085 (reuse
powerpcor add a separate family) is still open, so the scope box under "Before merge" is unchecked. The change reverses one pinned test, named under "Change and scope".Problem and expected behavior
Smallest trigger: an ELF64 header with
e_machine = 21.elfArchitecture()had no case for it, soparseElfreturnedunsupported ELF architecture: e_machine 21andrea analyze,rea inspectandrea inspect-artifactall answeredtarget_unavailable. The specific refusal inghidraPowerPcUnsupportedReason("This Ghidra PowerPC lane supports ELF32 only; PPC64 remains unsupported.") could not be reached by a realEM_PPC64file.Expected: the family is recognized with its class, byte order,
e_typeande_flags, and providers decline with their own reasons.Change and scope
elfArchitecture()takes an optional ELF class and namespowerpcfor machine 21 only when the caller commits ELF64. Header admission passes the class.parseElfalready keepsElfFamilyMetadatafor the family, so class 64, byte order,e_typeande_flags(ELFv1 or ELFv2 ABI in the low two bits) are retained with no further change.EM_PPC64stays unclassified and is refused as before. Classified by number alone, it would have become apowerpctarget with class 32, which the 32-bit Ghidra lane admits.ppc64, their Evidence subject has no family for it, and records saved earlier stay valid.docs/ghidra-ppc.mdstates the boundary.Reversed on purpose: the test "does not recognize EM_PPC64 as the 32-bit family" in
binaryTarget.powerpc.test.ts.Not included: any Ghidra lane (pinned language, verification fixture), changes to
GhidraPowerPcProfile, the Hopper, IDA and Kuna messages, and a subject family forppc64reader reports. That last one changes what views expect from saved Evidence, so it belongs with a provider lane.Changes after review
EM_PPC64then entered the 32-bit lane.eba42b74brequires ELF64.ppc64to thepowerpcsubject. Greptile pointed out that views would refuse saved records.6e03b1842reverts it. The same effect reached further than that file:elfArchitecture()also feeds the Evidence subject of the ELF dependency, notes, unwind, hardening, initializer and DWARF readers. Requiring the class from the caller leaves all of them as onmain.Contract and boundary impact
src/domain/elfFixedHeader.tselfArchitecture()andadmitElfFixedHeaderFacts()(ELF machine and class to family). Consumer:parseElfand target resolution, then provider target support.EM_PPC64file,analyze,inspectandopen_binarychange fromtarget_unavailable(file_format_rejected) tocapability_unavailable(target_unsupported) with per-provider reasons, andinspect-artifactreturns its inventory. Static reader commands are unchanged.docs/public/product-catalog.json), package, or installation impact: none;npm run docs:checkpassed with no generated changes.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated:
src/domain/binaryTarget.powerpc.test.ts: ELF64EM_PPC64headers (little-endian with flags 2, big-endian with flags 1) classify aspowerpcwith class 64; an ELF32 header that claimsEM_PPC64is refused in both byte orders; machine 22 is still refused by name.src/domain/elfFixedHeader.test.ts:elfArchitecture(21, 64)ispowerpc;elfArchitecture(21, 32)andelfArchitecture(21)are unclassified.src/ghidra/GhidraPowerPcProfile.test.ts: the three header shapes of the public samples in [Feature] Admit 64-bit PowerPC ELF (EM_PPC64, 21) through a pinned Ghidra lane #12085 are refused with a reason containing "PPC64" byinspectTargetSupportandresolveAnalysisProfile; Hopper and IDA decline an ELF64 little-endianpowerpctarget.src/domain/native/nativeExportParser.test.ts: machine 21 keeps the reader nameppc64.Base reproduction or other evidence (executed):
main's classifier and this branch's tests, 3 tests fail: the two classification cases and theelfArchitecturecontract.User-visible CLI/MCP output,
rea analyze <file> --provider ghidraonbin/esbuildfrom npm@esbuild/[email protected](sha256487759a8814cc6360234d085fc3bc65fec828c59de097bbcdbead2501f0628d9). The Debian big-endian file and the PyPI shared object from [Feature] Admit 64-bit PowerPC ELF (EM_PPC64, 21) through a pinned Ghidra lane #12085 give the same result.main(23adfc610):This branch, target-origin rejections:
On the same three files,
inspect-elf-dependenciesandinspect-go-binarygivearchitecture: ppc64and no subject architecture, as onmain. A 52-byte ELF32 big-endianET_EXECheader withe_machine = 21givestarget_unavailableon this branch, as onmain.Remaining proof gaps: no Ghidra, Hopper, IDA or Kuna installation was available, so each provider's decline was observed in the CLI's rejection list (next to an availability rejection for the missing provider) and in unit tests, not from a configured provider. The full built test group was not run; the source group and the 31 test files that mention the family or the changed functions were. Not run on macOS or Windows.
Boundary regressions:
tests/boundary/goRustSubjectArchitecture.test.tsis unchanged and still pins that appc64report has no subject family. No lifecycle surface is touched.For evidence-bearing changes:
Validation performed
Linux x64, Node 24, on
ffae857c2plus this branch ateba42b74b.node scripts/ci/test-group.mjs source— 4371 files, 31,212 tests passed, 0 failed, 74 skippednpx vitest runon the 31 test files that mentionpowerpc,ppc64,elfArchitecture,architectureForElfMachine,binaryMetadataArchitectureor the ELF architecture refusal — 732 tests passednode scripts/run-typescript.mjs --noEmit— no errorsnpm run check:fast— passednode scripts/verify/architecture-guards.mjs— passed across 2873 source filesnpm run docs:check— passednpx oxfmt --check src/domain src/ghidra docs/ghidra-ppc.md— all formattednpm run build, thennode scripts/verify-go-binary.mjswith Go 1.24.7 — passed withmain's script; itslinux/ppc64fixture still has no subject familynode scripts/rea.mjsanalyze --provider ghidra,inspect-artifact,inspect-elf-dependenciesandinspect-go-binaryon the three public files from [Feature] Admit 64-bit PowerPC ELF (EM_PPC64, 21) through a pinned Ghidra lane #12085 and on the ELF32 header above — results as shownThe first CI run failed in Static checks on
tests/boundary/providers/CutterBridgeService.test.ts(108,31)(TS2322). That came frommain:7005e2780, the commit before #12088, failstypecheckwith the same error, andb236bcfe3passes. This branch does not touch that file.Compatibility, safety, and release
target_unavailablefor ELF64EM_PPC64files now receivescapability_unavailablewith provider reasons.Author readiness
Human owner: @Davmunrey
Before merge
type(scope): outcome.