Skip to content

feat(ghidra): verify and pin the 32-bit ARM (armhf) lane - #1922

Open
BaaRai wants to merge 31 commits into
morluto:mainfrom
BaaRai:feat/armhf-lane
Open

BaaRai wants to merge 31 commits into
morluto:mainfrom
BaaRai:feat/armhf-lane

Conversation

@BaaRai

@BaaRai BaaRai commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1745.

Backs the arm entry in the provider-neutral architecture set with a verified 32-bit ARM lane and pins ARM:LE:32:v7 for the admitted shape instead of Ghidra header auto-selection, which has several plausible wrong answers for ARM/Thumb-2 interworked images.

Problem and expected behavior

BINARY_ARCHITECTURES admitted arm with no verified fixture or statement covering armhf Linux ELF, so the entry was an allowlist guess. The issue asks to confirm or refute that, add the lane in the shape of the other architecture work (admit ELF32 EM_ARM, little-endian, ET_EXEC; select ARM:LE:32:v7; record the observed language/compiler spec in Evidence; refuse the rest with a specific unsupported constraint), and verify with a source-owned cross-compiled armhf fixture including a Thumb-2 interworking case, with no third-party binaries.

Change and scope

  • EM_ARM ELF targets now retain class, byte order, e_type and raw e_flags as provider-neutral facts (an arm metadata member mirroring the MIPS one). Mach-O 32-bit ARM slices and PE ARM images keep their existing classification; only ELF ARM carries the metadata.
  • Admission: little-endian ELF32 ET_EXEC with EABI5 is admitted; hard-float (armhf) and unspecified float conventions are covered. ELF64, big-endian armeb, EF_ARM_BE8 mixed-endian images, legacy or older ABIs, EF_ARM_ABI_FLOAT_SOFT, PIE (ET_DYN) and relocatable images are refused with their specific constraint rather than a guessed profile.
  • Pinning: the profile pins -processor ARM:LE:32:v7 with the default compiler spec through a provider-pinned-v1 selection; the bridge-reported language_id is checked against it after import (the DOS expectedLanguageId mechanism). A caller-selected REA_GHIDRA_LANGUAGE_ID/REA_GHIDRA_COMPILER_SPEC_ID still wins; combining the pin with an environment override is a typed refusal.
  • Evidence: the profile records the lane identity elf32-exec-le-eabi5-v7-p1... elf32-exec-le-eabi5-v7-pinned-v1, the raw header facts and the declared float ABI basis without interpreting it into a calling-convention claim. Sessions carry the limitation that the ELF float ABI declaration does not change the modeled calling convention.

Verification

Locally verified on Linux with Ghidra 12.1.4 PUBLIC, clang 21.1.8 (Debian) and GNU readelf 2.47; fork PRs currently receive no CI check runs in this repository, so results below are from this machine:

  • New npm run verify:ghidra:arm: builds the source-owned fixture with arm-linux-gnueabihf (ARMv7-A, hard float) containing an ARM-mode probe (mov r0, #42, e3a0002a) and a Thumb-2 interworked probe (movs r0, #42, 202a); checks REA's ELF interpretation against GNU readelf; asserts the pinned language after import; decodes both instruction-set states under ARM:LE:32:v7; recovers the direct call edge, pseudocode, global and marker bytes; walks a snapshot round-trip asserting the pinned profile parameters; proves typed MCP refusals for legacy-EABI and BE8 header variants; and closes with CLI/MCP parity and source-byte immutability.
  • vitest src/ghidra/GhidraArmProfile.test.ts (admission, refusal matrix, pin read-back, caller-override precedence), src/domain/binaryTarget.test.ts, and the Ghidra suite pass; tsc --noEmit clean; oxlint reports no new warnings on the touched files.

Author readiness

Human owner: @BaaRai

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-25T14:25:10.078506Z
We couldn’t complete this review. Comment @codex review to try again.
8b81949 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

language_id: "ARM:LE:32:v7",

P1 Badge Establish ARMv7 before applying the v7 language pin

When an EABI5 ELF32 target is actually ARMv8 AArch32 (or another non-v7 ISA) and no caller language override is supplied, ghidraArmUnsupportedReason admits it using only class, byte order, e_type, and e_flags; the EABI version does not identify the CPU architecture, which is normally declared in .ARM.attributes. This pin then analyzes valid non-v7 instructions under the wrong processor instead of returning the promised typed refusal, so parse and require a supported Tag_CPU_arch (and reject missing or conflicting attributes) before selecting ARM:LE:32:v7.

AGENTS.md reference: AGENTS.md:L21-L21



P2 Badge Exercise an actual Thumb-2 encoding

When this verifier is used to substantiate the new Thumb-2 lane, the .cpu arm7tdmi probe's movs r0, #7 is only the 16-bit Thumb-1 encoding, and assertArmProbe explicitly requires length 2 and bytes 0720 in tests/conformance/ghidra/arm-checks.mjs:105-108. The real Ghidra run can therefore pass without decoding any Thumb-2-only instruction, so it does not validate the advertised Thumb-2 case; include a 32-bit Thumb-2-only probe and assert its encoding.

AGENTS.md reference: AGENTS.md:L44-L44


https://github.com/morluto/rea/blob/73cda10245b8267314a6f74594eb3ea4a7ea8473/src/generatedMcpToolCatalog.ts#L32
P2 Badge Remove the unused generated catalog from the build

This module has no importers, but tsconfig.build.json:7 includes every src/**/*.ts file and package.json:44-45 ships all of dist; consequently every build parses and emits this 6,677,963-byte literal and every package installs the generated JavaScript even though it has no effect on tool registration. The canonical test catalog is already generated into .cache/mcp-tool-catalog.json, so remove this source artifact rather than adding permanent build and package bloat.

AGENTS.md reference: AGENTS.md:L38-L38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source verdict: REQUEST_CHANGES at head 73cda10.

Reviewed all 20 changed files against merge base fb94d9d (current PR base dfe3117), including ELF metadata propagation, admission/profile resolution, configured-language precedence, launcher arguments, post-import language/compiler checks, Evidence/snapshot consumers, and the source-owned verifier.

Two P2 defects:

  1. Caller-selected languages retain the ARM pinned-lane marker, so successful sessions using e.g. ARM:LE:32:Cortex falsely report that ARM:LE:32:v7 was pinned and checked in execution/Evidence limitations.
  2. The advertised Thumb-2 interworking fixture contains only standalone Thumb-1-compatible MOVS/BX instructions, with no ARM-to-Thumb call. The verifier's call-edge assertion checks only the ARM C entry-to-leaf edge, so it cannot establish the core interworking claim of #1745.

Validation: 81 tests across GhidraArmProfile, GhidraProvider.behavior, GhidraSessionValues, binaryTarget and HopperProviderDiscovery passed; tsc --noEmit passed; all 843 test files discovered exactly once; git diff --check passed. Touched-source oxlint completed with 14 warnings (not a zero-warning claim). An ephemeral fake-provider boundary witness reproduced finding 1; LLVM Clang 23.1.3 object compilation/disassembly reproduced finding 2 without executing target code. Used installed Node 24.19.0/npm 11.17.0, NOT the exact .nvmrc/packageManager pins 24.18.0/11.16.0. Locked dependencies installed only in the private checkout; initial ambient npm-cache access failed, then an isolated private cache succeeded.

Independent readiness: GitHub reports no check runs, mergeable=false / mergeable_state=dirty (CONFLICTING/DIRTY). Conflicts are an integration blocker, not a third source finding. The author's Linux/Ghidra verification is reported evidence, not independently reproduced here. Real Ghidra armhf CLI/MCP/snapshot verification, compiled provider boundary tests, full local gate, and package/docs gates were not run; no caller-supplied GHIDRA_INSTALL_DIR or GNU readelf/LLD prerequisite was available. No Ghidra/Java/toolchain installation, GUI interaction, target execution, fixes, commits, pushes, merges, or draft changes.

Checkout: /private/tmp/rea-pr1922.2CxtjY, detached exact head, empty full porcelain. Primary checkout preserved.

Comment thread src/ghidra/GhidraProviderClient.ts Resolved
Comment thread tests/conformance/ghidra/arm-probe.S Resolved
@baron baron added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: providers Provider and capability discovery, including provider proposal triage area: tests Test suite and verification blocked Waiting for a prerequisite issue or external dependency labels Oct 11, 2026
@BaaRai
BaaRai force-pushed the feat/armhf-lane branch 2 times, most recently from d3ecb47 to 1b67006 Compare October 11, 2026 18:50
The arm entry in the provider-neutral architecture set was an allowlist
without a verified 32-bit ARM fixture, and Ghidra header auto-selection
has several plausible wrong answers for ARM/Thumb-2 interworked images.

EM_ARM ELF targets now retain class, byte order, e_type and raw e_flags
as provider-neutral facts (an arm metadata member mirroring the MIPS
one); Mach-O 32-bit ARM slices and PE ARM images keep their existing
classification. The lane admits little-endian ELF32 ET_EXEC images
declaring EABI5 with hard-float (armhf) or unspecified float
conventions, and refuses ELF64, armeb, EF_ARM_BE8 mixed-endian images,
legacy or older ABIs, EF_ARM_ABI_FLOAT_SOFT, PIE and relocatable images
with their specific constraint rather than a guessed profile.

For the admitted shape the profile pins -processor ARM:LE:32:v7 with
the default compiler spec through a provider-pinned-v1 selection, and
the bridge-reported language_id is checked against it after import; the
session limitations stating that pin are emitted only when the provider
pin is actually in effect, never under a caller-selected
REA_GHIDRA_LANGUAGE_ID override, which keeps winning over the pin. The
profile records the lane identity elf32-exec-le-eabi5-v7-pinned-v1 and
the declared float ABI basis without interpreting it into a
calling-convention claim.

A new verify:ghidra:arm lane builds a source-owned arm-linux-gnueabihf
fixture (ARMv7-A, hard float) whose entry calls an ARM leaf and a
Thumb-2 probe, and whose ARM probe branches into the Thumb probe and
back: genuine interworking. GNU readelf checks REA's ELF interpretation,
the pinned language is asserted after import, the ARM immediate and both
32-bit Thumb-2 encodings (movw/movt) are decoded per instruction state,
both cross-state call edges are recovered, a snapshot round-trip asserts
the profile parameters, typed refusals cover legacy-EABI and BE8
variants, and CLI parity closes the run.

Fixes morluto#1745
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review


P1 Badge Verify the ARM ISA before admitting the v7 lane

When an ELF32/LE/ET_EXEC image is EABI5 hard-float (or unspecified) but its .ARM.attributes declares an ISA other than ARMv7—for example, an AArch32 ARMv8 binary using CRC instructions—these header-only checks reach this return null, and the profile later forces ARM:LE:32:v7. The real verifier builds only with -march=armv7-a, so the change admits unverified instructions under the wrong processor and can leave valid opcodes undecoded or modeled with v7 semantics; parse Tag_CPU_arch/required extensions and reject anything outside the verified v7 shape (or select a matching language).

AGENTS.md reference: AGENTS.md:L44-L44


https://github.com/morluto/rea/blob/156b53a34d0c5a7f53af7f78080445cb2b952bc3/src/generatedMcpToolCatalog.ts#L32
P2 Badge Keep test catalog metadata out of runtime source

This file embeds 6,677,963 bytes of catalog JSON even though scripts/generate-mcp-tool-catalog.mjs writes the test metadata to .cache/mcp-tool-catalog.json, and a repo-wide search finds no importer for this module. Because tsconfig.build.json includes every src/**/*.ts file and package.json publishes all of dist, every build still parses and emits this dead blob and every installed package receives it; remove this source artifact and leave the generated catalog in .cache.

AGENTS.md reference: AGENTS.md:L38-L38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…7 pin

The EABI version does not identify the CPU architecture, so header-only
checks admitted any EABI5 ELF32 under ARM:LE:32:v7 while the verifier had
only built armv7-a. The resolver now reads Tag_CPU_arch from the aeabi
attributes section file-level, like the MIPS ABI record, and the lane
admits only a declared v7: another ISA or no readable declaration gets a
typed refusal naming what it declares. The real verifier gains a real
armv8-a build and an attributes-stripped variant as refusal cases.

Also drops a stray generated tool catalog that no importer reads.
…rces

Pure assembly records no float convention, so the v8 variant linked with
a soft-float marker and refused on the float gate before the ISA reason.
Compile the same C and probe sources as the fixture with armv8-a+crc+fp
so only the declared ISA differs.
@BaaRai

BaaRai commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Both findings are addressed.

P1, ISA verification before the v7 pin: fixed in 48946c7. The resolver now reads Tag_CPU_arch from the aeabi .ARM.attributes section file-level, the same pattern as the MIPS ABI record, so declarations beyond the initial header probe are still read. The lane admits only a declared v7 (enum 10); any other declaration refuses with a typed reason naming what the image declares (v8-A, v6, v7E-M, ...), and an absent or malformed declaration refuses because the EABI version does not identify the CPU architecture. The profile records cpu_arch and its name beside the existing arm_elf facts.

The real verifier now proves both sides: the admitted fixture's readelf output must declare Tag_CPU_arch v7 and the resolved metadata must agree (cpuArch 10), a real armv8-a+crc+fp build of the same conformance sources must refuse with the v8-A reason, and the fixture with its .ARM.attributes removed must refuse with the Tag_CPU_arch reason. That lane ran end to end on Ghidra 12.1.4 with all four typed refusals (legacy EABI, BE8, v8-A, absent attributes). New boundary tests parse real clang-emitted attribute payloads (v7, v8, v6 with a CPU_name string tag, absent, malformed, and a table truncated past the file, which records a limitation).

One build detail worth recording from debugging the v8 variant: pure assembly records no float convention, so an asm-only armv8 binary links with the soft-float marker and refuses on the float gate instead of the ISA gate. The refusal variant is therefore built from the same C and probe sources as the fixture, so only the declared ISA differs.

P2, the generated catalog: removed in the same commit. It was a stray 6.6 MB source artifact with no importers that slipped into the squash; the canonical generated catalog lives in .cache/mcp-tool-catalog.json as you noted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b3539f5e3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/ghidra/GhidraArmProfile.ts Resolved
Comment thread src/application/ArmElfAttributes.ts Resolved
Comment thread src/ghidra/GhidraArmProfile.ts Resolved
Comment thread src/application/ArmElfAttributes.ts Resolved
…ding

A cortex-r5 build declares Tag_CPU_arch v7 with the Realtime profile, so
the arch enum alone admitted a variant the lane never verified; the
resolver now reads Tag_CPU_arch_profile beside the arch enum and the
lane admits the Application profile only, with typed refusals for the
Realtime and Microcontroller profiles and for undeclared profiles.

The aeabi scanner now walks length-delimited scope blocks instead of a
flat tag stream, so Section and Symbol scope bytes can never read as a
CPU_arch declaration, and a later File scope supersedes an earlier one
as sequential consumers do; payloads for both shapes are cross-checked
against GNU readelf. The section-table entry size must equal the ELF32
header size exactly, like the MIPS ABI reader, so a padded stride cannot
multiply a sparse file into an oversized allocation. A section table
that extends past the file records an inspection limitation in the
profile parameters, mirroring abi_flags_limitations.

The real verifier gains a cortex-r5 refusal variant built from the same
conformance sources, and asserts the fixture declares the Application
profile.
@BaaRai

BaaRai commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Findings 1, 2, and 4 are fixed in d9024b3; on finding 3 I followed the MIPS precedent instead of refusing and explain below.

  1. Application profile (P1): correct, and the real cortex-r5 build confirms it byte for byte (06 0a 07 52). The resolver now reads Tag_CPU_arch_profile beside the arch enum from the same File scope, and the lane admits the Application profile only: Realtime and Microcontroller profiles and undeclared profiles each get a typed refusal naming what the image declares. The real verifier gained a cortex-r5 refusal variant built from the same conformance sources, with readelf asserting it declares v7 plus Realtime before the refusal is checked, and the admitted fixture must declare the Application profile.

  2. Scope lengths (P1): correct. The scanner now walks length-delimited scope blocks instead of a flat tag stream: File scopes are parsed within their declared block, Section and Symbol scopes are skipped whole, content before a scope tag is malformed, and a later File scope supersedes an earlier one as sequential consumers do. I built the adversarial payloads and cross-checked them against GNU readelf before writing the parser: an empty File scope followed by a Symbol scope containing 06 0a renders as no File CPU_arch under readelf and now reads as no declaration here, a v7 File scope followed by that Symbol scope still reads v7, and readelf renders dual File scopes sequentially, which is what the last-wins rule mirrors. All three are boundary tests.

  3. Truncated table (P2): the concern is real, but I did not add a refusal, because the repo already answers this exact situation the other way: the MIPS reader records a limitation when the section table extends past the file, and the lane admits while disclosing it through abi_flags_limitations in the profile parameters. The ARM lane now does the same, recording attributes_limitations under arm_elf, so the partial scan is visible in every admission instead of silently treated as complete coverage. If you prefer refusal over disclosure for this lane, say so and I will switch it; the truncated case without an examinable attributes header already yields no declaration and refuses.

  4. Table allocation (P2): fixed by requiring e_shentsize to equal the exact ELF32 section header size of 40, the same check the MIPS ABI reader applies (stride !== entrySize), so a padded stride is a typed target-resolution error rather than an allocation multiplier; covered by a boundary test with stride 0x2000.

Verified on Linux: filesystem and ghidra suites (1590 passed, 47 skipped), and the real Ghidra lane end to end with five typed refusals now (legacy EABI, BE8, v8-A, Realtime profile, absent attributes).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9024b31ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/application/ArmElfAttributes.ts Resolved
Comment thread src/application/ArmElfAttributes.ts Resolved
Keeps both the analyzer-override commitment checks and the MIPS
relocatable limitation source from main beside the ARM lane pin and
its attributes-verified admission.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c8c89ef37

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/application/ArmElfAttributes.ts Resolved
Comment thread src/application/ArmElfAttributes.ts Resolved
Comment thread scripts/verify-real-ghidra-arm.mjs Resolved
@CassieFox23

CassieFox23 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: I ran the real Ghidra ARM check from this PR on head 7c8c89e, and it passes. On base 89f5e48 Ghidra picks ARMv8 for the test file, and head pins ARMv7, with the same decoded code. Still open: the CI knip failure, which is one unused export, and a merge conflict with main.

Check Result
Typecheck It passes.
Knip (the CI failure) Fails the same way as CI. One finding: isVerifiedArmAdmission in src/ghidra/GhidraArmProfile.ts, line 60.
9 unit and boundary test files 203 passed, 1 skipped.
scripts/verify-real-ghidra-arm.mjs Passed in 27.6 s. Language ARM:LE:32:v7. Five refusals: legacy EABI, BE8, v8-A, Realtime profile, no attributes. Process check clean.
Same file on base 89f5e48 Ghidra picked ARM:LE:32:v8. Head picked ARM:LE:32:v7.
Decode, base against head Ten instructions (ARM and Thumb-2) match byte for byte. Two functions give the same pseudocode. Only the language label differs.
Four odd files: big-endian, soft-float, PIE, object file Head refuses each with a clear reason. Base opens each.
Float ABI left unspecified Head admits it as v7.
Caller REA_GHIDRA_LANGUAGE_ID=ARM:LE:32:Cortex Caller wins. The two v7 pin sentences are gone from the limitations, so that review point holds up.
Same override on a saved snapshot Refused. The error says the profile does not match.
Real armhf ls from Debian's GNU coreutils (GPL-3.0-or-later) The ELF facts match readelf. Head refuses it because it is a PIE. Base opens it as v8.

Two small notes. With the Cortex override on, arm_support_lane still says "v7-pinned". But language_selection says "configured-v1". Is that label meant to change too? Also, on this one small test file, the pin changes the recorded language and not the decode.

Not run

Edit (2026-10-13): The retest on 0b754a095 covers the merge item below. The rest is still not run.

  • Codex's open findings. I did not test them. They are ISA overrides in Section and Symbol scope, tag 65 read as a string, tag zero as a separator, and CPU profile 0.
  • The verifier's two fixed readelf calls. Not tested.
  • A real ELF64 file marked as ARM. The unit tests cover that branch.
  • The refusal text for a committed ARM profile combined with an override. The CLI snapshot hit the generic profile mismatch first.
  • Any merge with current main, which conflicts with this PR. Done in the retest. Morluto merged main into the branch, and I tested that head.
  • The full test suite.

Thanks, BaaRai, for the careful work and the clear docs. I ran this PR as is, at 7c8c89e against its base 89f5e48. Another build may have run on the box while I timed the run.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0
  • Head and base: 7c8c89e and 89f5e48
  • Other: Ghidra 12.1.4, JDK 21.0.12.1, clang 22.1.8 (you used 21.1.8), GNU readelf 2.46.1 (you used 2.47)
  • Other: llvm-objcopy is not installed here. I used the copy inside the Rust toolchain, version 22.1.6, through a small wrapper script. It removed .ARM.attributes and left Machine ARM and the same flags.
Commands
git -C ~/code/rea-mirror/rea.git archive 7c8c89ef3 | tar -x -C /tmp/p1922/head
git -C ~/code/rea-mirror/rea.git archive 89f5e489a | tar -x -C /tmp/p1922/base
npm ci && npm run build && npm run test:prepare            # head; base: npm ci && npm run build
npm run typecheck                                          # rc 0
npm run knip                                               # rc 1, one unused export
node_modules/.bin/vitest run <9 test files>                # rc 0, 203 passed, 1 skipped
REA_ARM_CLANG=/usr/bin/clang REA_ARM_OBJCOPY=<wrapper> node scripts/verify-real-ghidra-arm.mjs   # rc 0
node scripts/rea.mjs inspect-native-load-image <file> --provider ghidra --format json --full-output
node scripts/rea.mjs inspect-native-instruction <file> <address> --provider ghidra --format json --full-output
node scripts/rea.mjs decompile <file> <function> --provider ghidra --format json --full-output

Each odd file used the lane's clang command with one change.

  • Big-endian: an armeb target.
  • Soft-float: -mfloat-abi=soft.
  • PIE: -fPIE -pie.
  • Object file: -c.
  • Unspecified float: clear 0x400 in e_flags.

Head exit codes were 1 for the four refusals and 0 for the unspecified-float file.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

…ssion export

Tag_NULL is not a valid File-scope attribute boundary, so a block whose
declarations follow a zero byte now reads as no declaration instead of
manufacturing a v7 admission. Tag_CPU_arch_profile zero is the declared
Not Applicable profile, not an absent or malformed one: the value is
preserved beside the arch enum and the lane refuses it by name. The real
verifier's two direct readelf calls honor REA_ARM_READELF like the
conformance helper. Removes the unused isVerifiedArmAdmission export
that failed the knip gate.
@BaaRai

BaaRai commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

CassieFox23, thank you again for the depth here: the base-vs-head language comparison, the hand-built odd files, the real Debian armhf ls, and catching the knip failure are exactly what this lane needed.

On your knip finding: fixed in ee40681. The export had no consumer, and it is gone.

On your lane-label question: the two fields describe different things on purpose. arm_support_lane names the admission lane, which stays "v7-pinned" because the image entered through the attributes-verified v7 admission regardless of the import language; language_selection records where the import language came from, so "configured-v1" under a caller override is the field that changes. That matches how the MIPS lanes behave under REA_GHIDRA_LANGUAGE_ID, where you observed the same split on #1898. If the maintainer prefers the lane id to track the selection instead, that is an easy rename, but the current split is deliberate.

The same commit also takes the three open Codex findings: Tag_NULL inside a File scope now rejects the block instead of letting following declarations through, Tag_CPU_arch_profile zero is preserved as the declared Not Applicable profile and refused by name rather than reported as no declaration, and the verifier's two direct readelf calls now honor REA_ARM_READELF like the conformance helper. New boundary tests cover the first two with real payload shapes, and the lane re-ran green on Ghidra 12.1.4 with all five refusals.

@BaaRai

BaaRai commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Codex, all three findings are fixed in ee40681: tag zero now rejects the File block instead of exposing the declarations that follow it, profile zero is preserved as the declared Not Applicable profile (refused by name at admission instead of reading as no declaration), and both direct readelf invocations resolve through REA_ARM_READELF like the conformance helper. Each has a boundary or gate test, and the real lane re-ran green.

@dandgabr dandgabr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review findings

  • [P1] Reject scoped ISA overrides before pinning. The parser skips Section and Symbol scopes wholesale, while admission relies on the File-scope v7/Application declaration. A valid scoped declaration can therefore describe code using a different ISA/profile that this pinned Ghidra language does not cover. Parse and reconcile scoped declarations with the lane, or refuse pinning when a scope is incompatible or cannot be verified.

  • [P2] Refuse admission when the section scan is incomplete. readArmElfCpuArch can return a readable v7 declaration together with a non-empty limitations list when later section headers are truncated, and ghidraArmUnsupportedReason ignores those limitations. An unexamined header could contain another ARM attributes section or declaration. Do not admit/pin when the section table was not fully examined.

  • [P2] Do not let conflicting declarations become last-wins proof of the lane. Repeated CPU architecture/profile tags and later File scopes overwrite earlier values. A crafted or malformed attributes payload can declare an incompatible ISA/profile and then v7/Application, which passes the admission check. Detect conflicting declarations and refuse the lane instead of treating the final value as sufficient evidence.

  • [P2] Parse string-valued AEABI tags above 32 according to the ABI encoding. The fallback treats every unknown tag as ULEB-valued, but odd tags above 32 carry NUL-terminated strings; in particular, Tag_also_compatible_with (65) contains encoded compatibility declarations. Its bytes can be consumed as subsequent tags and overwrite the primary CPU declaration (or make a valid payload appear malformed). Skip/decode these string-valued tags by their specified encoding and keep compatibility data distinct from the primary File-scope ISA declaration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee40681478

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/application/ArmElfAttributes.ts Resolved
…cans

Section and Symbol scopes are now parsed, not skipped: a scoped ISA or
profile declaration that disagrees with the File scope reads the payload
as no declaration instead of silently pinning the File-scope language
over code the scope describes otherwise. Repeated ISA or profile tags,
and repeated File scopes, must agree; the last writer is no longer proof
of the lane. Tag_nodefaults carries no value, and odd tags above 32,
such as Tag_also_compatible_with, are skipped as NUL-terminated strings
so their bytes cannot masquerade as later tags. An attributes section
declared v7 with an incompletely examined section table is refused:
unexamined headers could carry another declaration, reversing the earlier
disclosure-only treatment two reviewers asked to change. Test literals
spell the Not Applicable profile as an escape instead of a raw NUL byte.
@BaaRai

BaaRai commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Thank you dandgabr, Codex, and CassieFox23. Cassie, your verification is what surfaced these open findings in the first place, and the lane held up under your Fedora run; dandgabr and Codex then closed the gaps you each listed as not run. All six findings are fixed in e0e25e9, including one place where I am reversing my own earlier position.

dandgabr:

  • Scoped ISA overrides (P1): Section and Symbol scopes are now parsed rather than skipped. A scoped Tag_CPU_arch or profile that disagrees with the File-scope declaration reads the payload as no declaration, so the File-scope pin can no longer paper over code a scope describes otherwise; a payload with a scoped declaration agreeing with the File scope still admits.
  • Incomplete section scan (P2): you are right, and I have reversed the disclosure-only treatment I argued for earlier. Two reviewers asked for refusal and the pin is a strong enough claim to require the fully examined table; the lane now refuses with a message naming the unexamined-headers risk, and the docs say so.
  • Conflicting declarations (P2): repeated ISA or profile tags, and repeated File scopes, must agree; the last writer is no longer proof of the lane. The dual-File-scope test flipped accordingly.
  • String-valued odd tags above 32 (P2): Tag_also_compatible_with and its odd neighbors are skipped as NUL-terminated strings, so their bytes cannot masquerade as later tags or overwrite the primary declaration.

Codex:

  • Tag_nodefaults (64) is handled as the no-value marker it is, so a valid v7/A block ending with 40 parses instead of reading as no declaration.
  • The test literals spell the Not Applicable profile as an escape; no raw NUL bytes remain in either file, so search and diff see them as text again.

Each new behavior has a boundary payload test, and the whole thing re-ran on real Ghidra 12.1.4: 383 tests green and the lane passing with all five typed refusals, lineage verified.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f5b220e29

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/application/ArmElfAttributes.ts Resolved
@BaaRai

BaaRai commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

The one red lane on this head looks like an infra flake. web_source_map / real-web-source-map failed during the capture-browser-scenario launch step: the Chrome wait_for [data-ready="source-map proof"] probe hit its 10s timeout and the scenario command exited 1 before any assertion ran. The identical lane passed on main at this merge's exact base commit, aacf740 (run 39286908529, fully green), and this branch does not touch the web or browser code paths.

Could someone with write access re-run that lane? Everything else on this head is green, and I will investigate immediately if the re-run fails the same way.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment thread src/application/ArmElfAttributes.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dff0f75b99

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +136 to +138
const value = readUleb128(section, cursor, end);
if (value === null) return null;
cursor = value.next;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate ARMv7 extensions before applying the v7 pin

When a normal -march=armv7ve ELF declares Tag_CPU_arch=v7/Application plus Tag_DIV_use=2 (and commonly virtualization-extension tags), this fallback consumes and discards those extension declarations. The target is then admitted and pinned exactly like the verified -march=armv7-a+fp fixture, even though verify-real-ghidra-arm.mjs probes no hardware-divide or virtualization instruction; preserve and gate these ISA-extension tags, or add matching real-Ghidra proof before accepting that shape.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 73342e9 (head fed0f06) by refusing the shape, not by verifying it: I could not run real Ghidra or an ARM clang on this host, so there is no evidence beyond the AEABI tag definitions and your point. The attribute reader now keeps Tag_DIV_use (44) and Tag_Virtualization_use (68) declarations from every scope (ArmElfMetadata.extensions). The lane refuses Tag_DIV_use=2 or a nonzero Tag_Virtualization_use with a typed reason naming the tag. Regressions: retains declared hardware-divide extensions with the v7 declaration (real v7/A payload plus 2c 02), and refusal cases for {44,2} and {68,3} in GhidraArmProfile.test.ts. All fail on the previous code. A control case with Tag_DIV_use=1/Tag_Virtualization_use=0 stays admitted. Admitting armv7ve later still needs a real-Ghidra verifier variant. Leaving this thread open for the maintainer, since the refusal is a stopgap rather than a verification.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status at head 2bbef3a. Refused: an ELF32 ARM target whose .ARM.attributes, in any scope, declare Tag_DIV_use (44) = 2, or Tag_Virtualization_use (68) with any nonzero value. Either condition alone is enough. Admission returns architecture_unsupported with "This Ghidra ARM lane admits armv7-a without the hardware-divide or virtualization extensions, and this image declares Tag_DIV_use=2 (or Tag_Virtualization_use=N); that extension needs its own verified build before admission." Evidence: only the AEABI tag definitions and your point. The real build probes no SDIV/UDIV or virtualization instruction, and I have no Ghidra run showing how ARM:LE:32:v7 decodes them. The tests show the refusal happens; they do not show the refusal is necessary. This is fail-closed, not verification. Widening it needs a real Ghidra run on an -march=armv7ve image. The real-Ghidra verifier run (npm run verify:ghidra:arm) is still needed on a Linux host with Ghidra and an ARM-capable clang/lld; this Windows host has neither, so the ARM lane is not verified by this change. Leaving this open for the maintainer.

Comment thread src/ghidra/GhidraArmProfile.ts Outdated
Comment on lines +86 to +87
if ((metadata.flags & EF_ARM_ABI_FLOAT_SOFT) !== 0)
return "EF_ARM_ABI_FLOAT_SOFT is outside this Ghidra lane; the verified lane covers hard-float and unspecified float conventions.";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Verify unspecified-float images before admitting them

When neither float-ABI bit is set, this condition falls through and admits the image, but the real MCP/Ghidra verifier only opens the fixture built with -mfloat-abi=hard and explicitly checks that the hard-float bit is present; the unspecified case is covered only by a module-level profile assertion. Since the change advertises unspecified float conventions as provider-supported, open such a variant through the real workflow or refuse it until that behavior is verified.

AGENTS.md reference: AGENTS.md:L79-L79

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 73342e9 (head fed0f06) by refusing unspecified float conventions, not by verifying them: no real-Ghidra run was possible on this host. Admission now requires EF_ARM_ABI_FLOAT_HARD, which matches the only variant verify-real-ghidra-arm.mjs opens. The refusal case flags: 0x05000000 -> requires EF_ARM_ABI_FLOAT_HARD fails on the previous code. Docs no longer claim unspecified float coverage. The profile still records float_abi as declared. Leaving this thread open for the maintainer, since the refusal is a stopgap rather than a verification.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status at head 2bbef3a. Refused: an ELF32 ARM target whose e_flags lack EF_ARM_ABI_FLOAT_HARD (0x400) and also lack EF_ARM_ABI_FLOAT_SOFT, i.e. an unspecified float convention. Soft-float was already refused. Admission returns architecture_unsupported with "This Ghidra ARM lane requires EF_ARM_ABI_FLOAT_HARD; images with an unspecified float convention need their own verified build." Evidence: the real verifier opens only the hard-float fixture, and arm-fixture.mjs/arm-checks.mjs assert the 0x400 bit. Nothing shows how Ghidra handles an unspecified-float image, so this refusal stops claiming coverage that was never verified; it does not verify anything. Widening it needs a real Ghidra run on an unspecified-float image. The real-Ghidra verifier run (npm run verify:ghidra:arm) is still needed on a Linux host with Ghidra and an ARM-capable clang/lld; this Windows host has neither, so the ARM lane is not verified by this change. Leaving this open for the maintainer.

Comment thread src/ghidra/GhidraArmProfile.ts Resolved
@Entrpi

Entrpi commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

For the maintainers and the author: as written, this PR refuses M-profile and soft-float EABI ELFs. That's REA's fail-closed default for anything the lane hasn't verified. But today those STM32 and other Cortex-M ELFs load, through automatic ARM:LE:32:v8.

Could an M-profile lane sit alongside the A-profile pin?

  • v6-M, v7-M and v7E-M → ARM:LE:32:Cortex;
  • v8-M → ARM:LE:32:v8-m.

ELFs whose float ABI the lane hasn't verified yet would stay admitted, with a limitation, until the lane verifies float passing.

The lane would reuse your .ARM.attributes reader. Would you rather add it here, or accept the reader as its own PR, credited to you?

@Entrpi

Entrpi commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

A correction to my earlier comment: the M-profile ELF lane on my fork ended up with a minimal .ARM.attributes reader of its own, which reads only Tag_CPU_arch, Tag_CPU_arch_profile and Tag_ABI_VFP_args. It doesn't reuse or depend on this PR, so please disregard my question about where your reader should go. The lane will become a PR after #7951. So that REA keeps one owner for .ARM.attributes, I'd propose that whichever of the two lands second switches to the other's reader.

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@BaaRai thanks for the PR — there are 14 open review threads here:

Could you address or reply to these? Once they're resolved and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@BaaRai also, this branch has merge conflicts with main — please resolve those along with the open threads.

Main moved ELF declaration reading into BinaryTargetExecutableProbes and
unified provider-pinned languages without -vN suffixes. The ARM attribute
read now runs after main's strict ELF range validation, the ARM pin joins
ghidraPinnedLanguage with the caller override still taking precedence, and
the ARM lane id and language selection follow main's suffix-free naming.
- read .ARM.attributes only from non-null section headers whose range
  stays clear of the ELF header and both header tables
- consume Tag_nodefaults' ULEB value and retain Tag_DIV_use and
  Tag_Virtualization_use declarations
- refuse unspecified float conventions and hardware-divide or
  virtualization extensions the real build does not verify
- carry the recorded inspection limitation into the refusal reason and
  name Tag_CPU_arch values 18-22
- treat a caller-selected REA_ARM_OBJCOPY as exclusive in the verifier
- make the conflicting-tag fixture lengths reach the conflict check
…the ARM lane

ARM attribute parsing reads its numeric fields through BinaryReader and the ARM verifier allocates its workspace through VerifierFixture, as main's architecture guards require. Behaviour is unchanged: every read was already bounds-checked, and the workspace is still removed on success and retained on failure.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment thread scripts/verify-real-ghidra-arm.mjs Resolved
Comment on lines +197 to +199
const dossier = functionDossierSchema.parse(
await call("analyze_function", { procedure: entry.address }),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Summary parsed as full dossier

The MCP analyze_function call returns a summary by default, but this code immediately parses it as a complete dossier. Once the import is fixed, the verifier still fails here before reaching the snapshot and refusal checks. Pass detail: "complete" on this call.

Suggested change
const dossier = functionDossierSchema.parse(
await call("analyze_function", { procedure: entry.address }),
);
const dossier = functionDossierSchema.parse(
await call("analyze_function", {
procedure: entry.address,
detail: "complete",
}),
);
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/verify-real-ghidra-arm.mjs
Line: 197-199

Comment:
**Summary parsed as full dossier**

The MCP `analyze_function` call returns a summary by default, but this code immediately parses it as a complete dossier. Once the import is fixed, the verifier still fails here before reaching the snapshot and refusal checks. Pass `detail: "complete"` on this call.

```suggestion
    const dossier = functionDossierSchema.parse(
      await call("analyze_function", {
        procedure: entry.address,
        detail: "complete",
      }),
    );
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 2bbef3a: analyze_function now passes detail: "complete" before functionDossierSchema.parse, as the PowerPC verifier does. Evidence is static only (the same call shape as the merged PPC verifier). I could not exercise it against Ghidra here, so I am leaving this thread open. The real-Ghidra verifier run (npm run verify:ghidra:arm) is still needed on a Linux host with Ghidra and an ARM-capable clang/lld; this Windows host has neither, so the ARM lane is not verified by this change.

Comment thread scripts/verify-real-ghidra-arm.mjs Outdated
const snapshot = parseAnalysisSnapshot(
JSON.parse(await readFile(snapshotPath, "utf8")),
);
assert.equal(snapshot.target.architecture, "arm");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Verifier reads obsolete identity fields

The snapshot and Evidence assertions still use the old identity layout. snapshot.target.architecture is now snapshot.target.identity.architecture. Evidence uses subject.identity.architecture and subject.identity.sha256, not direct architecture or digest fields.

These assertions fail for valid current output. Update these reads together, including the saved Evidence loop and CLI assertions, so the snapshot round-trip and CLI checks can finish.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/verify-real-ghidra-arm.mjs
Line: 206

Comment:
**Verifier reads obsolete identity fields**

The snapshot and Evidence assertions still use the old identity layout. `snapshot.target.architecture` is now `snapshot.target.identity.architecture`. Evidence uses `subject.identity.architecture` and `subject.identity.sha256`, not direct `architecture` or `digest` fields.

These assertions fail for valid current output. Update these reads together, including the saved Evidence loop and CLI assertions, so the snapshot round-trip and CLI checks can finish.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 2bbef3a. The snapshot check reads snapshot.target.identity.architecture, and the saved Evidence loop and the CLI assertions read subject?.identity.architecture and subject?.identity.sha256. These match the current analysisSnapshot and evidence schemas and the PowerPC verifier. The MCP client calls also now use the SDK's two-argument callTool(params, { timeout }) form; the old three-argument call dropped the timeout. Evidence is static only, so I am leaving this thread open. The real-Ghidra verifier run (npm run verify:ghidra:arm) is still needed on a Linux host with Ghidra and an ARM-capable clang/lld; this Windows host has neither, so the ARM lane is not verified by this change.

Comment thread scripts/verify-real-ghidra-arm.mjs Outdated
throw new Error(
`Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`,
);
const execute = promisify(execFile);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Verifier skips required command owner

The new verifier starts compilers, readers, objcopy, and the CLI through promisify(execFile). The repository's testing guide requires new or touched verifiers to use createVerifierCommands() and close that owner before checking cleanup. Direct launches leave compiler and linker children outside that cleanup owner.

Share one command owner across this script and its fixture helpers. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/verify-real-ghidra-arm.mjs
Line: 48

Comment:
**Verifier skips required command owner**

The new verifier starts compilers, readers, objcopy, and the CLI through `promisify(execFile)`. The repository's testing guide requires new or touched verifiers to use `createVerifierCommands()` and close that owner before checking cleanup. Direct launches leave compiler and linker children outside that cleanup owner.

Share one command owner across this script and its fixture helpers. This repository requirement must be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 2bbef3a. One createVerifierCommands() owner now runs every command: the fixture compiler (buildArmFixture(workspace, commands)), GNU readelf (inspectArmReadelf(commands, path) and the attribute reads), the v8-A and cortex-r5 builds, objcopy (removeArmAttributes through commands.exec) and the CLI. The owner is closed through workspaceFixture.closeEarly before completeVerifierRun and assertVerifierCleanupComplete. The workspace is retained on any failure, following verify-real-ghidra-ppc.mjs. execFile/promisify are gone from the script and both ARM conformance helpers. I could not run this here, so I am leaving the thread open. The real-Ghidra verifier run (npm run verify:ghidra:arm) is still needed on a Linux host with Ghidra and an ARM-capable clang/lld; this Windows host has neither, so the ARM lane is not verified by this change.

@@ -0,0 +1,72 @@
# 32-bit ARM (armhf) analysis through Ghidra

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Provider guide uses wrong directory

This new provider setup guide is placed at the documentation root. The documentation guide assigns analysis-engine configuration and format prerequisites to docs/providers/.

Move the ARM guide there and update its links and navigation entry together. This repository requirement must be satisfied before merging.

Context Used: Documentation (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/ghidra-arm.md
Line: 1

Comment:
**Provider guide uses wrong directory**

This new provider setup guide is placed at the documentation root. The documentation guide assigns analysis-engine configuration and format prerequisites to `docs/providers/`.

Move the ARM guide there and update its links and navigation entry together. This repository requirement must be satisfied before merging.

**Context Used:** Documentation ([source](https://github.com/morluto/rea/blob/main/docs))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 2bbef3a: the guide moved to docs/providers/ghidra-arm.md. The nav entry in docs/.vitepress/documentation.ts now uses source providers/ghidra-arm.md and sits next to the RISC-V guide. docs/README.md and the docs/providers/ghidra-provider.md link are updated, and the guide's only link is absolute. tests/conformance/readmeConsistency.test.ts passes (8/8). npm run docs:check cannot run on this host: it stops at the missing Windows native build before the documentation build. I am leaving this thread open until a docs build confirms it.

- import functionDossierSchema from domain/native/functionDossier, request detail: complete, and read snapshot and Evidence identity from their identity objects
- run the compiler, readelf, objcopy and the CLI through one createVerifierCommands owner, closed before the lineage check
- pass MCP call timeouts in the client's current two-argument callTool form
- read fixture, verifier and test ELF fields through BinaryReader, and read ELF64 section-table offsets in the file's byte order
- allocate the objcopy prerequisite test directories through createTestTempDirectory
- move the ARM guide to docs/providers and update its navigation and links
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment on lines +409 to +412
// The exact ELF32 entry size bounds the table allocation by the header
// count alone; a padded stride could multiply a sparse file into one.
if (tableOffset < metadata.headerSize || stride !== 40)
return err("invalid ARM section table offset or entry size");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Padded ARM files stop opening

A complete ELF32 ARM file with padded section headers, such as e_shentsize = 44, passes the shared ELF reader but fails this new exact-size check. readElfMetadata forwards the error before provider selection, so even Hopper loses access to the file.

This also violates the repository directive to use the owner's parsed facts rather than reinterpret the source. Reuse the shared ELF table reader, or retain unknown attributes with a limitation when inspection is unsupported.

Context Used: AGENTS.md (source)

Knowledge Base Used: Reverse-engineering toolchains

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/application/ArmElfAttributes.ts
Line: 409-412

Comment:
**Padded ARM files stop opening**

A complete ELF32 ARM file with padded section headers, such as `e_shentsize = 44`, passes the shared ELF reader but fails this new exact-size check. `readElfMetadata` forwards the error before provider selection, so even Hopper loses access to the file.

This also violates the repository directive to use the owner's parsed facts rather than reinterpret the source. Reuse the shared ELF table reader, or retain unknown attributes with a limitation when inspection is unsupported.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

**Knowledge Base Used:** [Reverse-engineering toolchains](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Freverse-engineering-toolchains.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: domain Domain logic, errors, and pure functions area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: providers Provider and capability discovery, including provider proposal triage area: tests Test suite and verification blocked Waiting for a prerequisite issue or external dependency enhancement New feature or request P2: medium Medium priority issue provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Confirm the 32-bit ARM (armhf / ARMv7 EABI) native lane and pin ARM:LE:32:v7 instead of auto-selection

6 participants