Repository navigation
Conversation
Codex Review Summary: ❌ FailedThis 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. |
💡 Codex Reviewrea/src/ghidra/GhidraArmProfile.ts Line 79 in 73cda10 When an EABI5 ELF32 target is actually ARMv8 AArch32 (or another non-v7 ISA) and no caller language override is supplied, AGENTS.md reference: AGENTS.md:L21-L21 rea/tests/conformance/ghidra/arm-probe.S Line 21 in 73cda10 When this verifier is used to substantiate the new Thumb-2 lane, the AGENTS.md reference: AGENTS.md:L44-L44 https://github.com/morluto/rea/blob/73cda10245b8267314a6f74594eb3ea4a7ea8473/src/generatedMcpToolCatalog.ts#L32 This module has no importers, but AGENTS.md reference: AGENTS.md:L38-L38 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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
left a comment
There was a problem hiding this comment.
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:
- 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.
- 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.
d3ecb47 to
1b67006
Compare
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
1b67006 to
156b53a
Compare
💡 Codex Reviewrea/src/ghidra/GhidraArmProfile.ts Line 46 in 156b53a When an ELF32/LE/ET_EXEC image is EABI5 hard-float (or unspecified) but its AGENTS.md reference: AGENTS.md:L44-L44 https://github.com/morluto/rea/blob/156b53a34d0c5a7f53af7f78080445cb2b952bc3/src/generatedMcpToolCatalog.ts#L32 This file embeds 6,677,963 bytes of catalog JSON even though AGENTS.md reference: AGENTS.md:L38-L38 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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.
|
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. |
There was a problem hiding this comment.
💡 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".
…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.
|
Findings 1, 2, and 4 are fixed in d9024b3; on finding 3 I followed the MIPS precedent instead of refusing and explain below.
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). |
There was a problem hiding this comment.
💡 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".
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.
There was a problem hiding this comment.
💡 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".
|
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.
Two small notes. With the Cortex override on, Not runEdit (2026-10-13): The retest on 0b754a095 covers the merge item below. The rest is still not run.
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
Commandsgit -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-outputEach odd file used the lane's clang command with one change.
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.
|
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. |
|
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
left a comment
There was a problem hiding this comment.
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.
readArmElfCpuArchcan return a readable v7 declaration together with a non-emptylimitationslist when later section headers are truncated, andghidraArmUnsupportedReasonignores 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.
There was a problem hiding this comment.
💡 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".
…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.
|
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:
Codex:
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. |
There was a problem hiding this comment.
💡 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".
|
The one red lane on this head looks like an infra flake. 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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
💡 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".
| const value = readUleb128(section, cursor, end); | ||
| if (value === null) return null; | ||
| cursor = value.next; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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."; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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 Could an M-profile lane sit alongside the A-profile pin?
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 |
|
A correction to my earlier comment: the M-profile ELF lane on my fork ended up with a minimal |
|
@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. |
|
@BaaRai also, this branch has merge conflicts with |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| const dossier = functionDossierSchema.parse( | ||
| await call("analyze_function", { procedure: entry.address }), | ||
| ); |
There was a problem hiding this 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.
| 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.There was a problem hiding this comment.
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.
| const snapshot = parseAnalysisSnapshot( | ||
| JSON.parse(await readFile(snapshotPath, "utf8")), | ||
| ); | ||
| assert.equal(snapshot.target.architecture, "arm"); |
There was a problem hiding this 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.
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.There was a problem hiding this comment.
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.
| throw new Error( | ||
| `Ghidra prerequisite unavailable: ${JSON.stringify(installation)}`, | ||
| ); | ||
| const execute = promisify(execFile); |
There was a problem hiding this 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)
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!
There was a problem hiding this comment.
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 | |||
There was a problem hiding this 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)
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!
There was a problem hiding this comment.
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
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| // 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"); |
There was a problem hiding this comment.
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.
Summary
Fixes #1745.
Backs the
armentry in the provider-neutral architecture set with a verified 32-bit ARM lane and pinsARM:LE:32:v7for 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_ARCHITECTURESadmittedarmwith 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 ELF32EM_ARM, little-endian,ET_EXEC; selectARM: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_ARMELF targets now retain class, byte order,e_typeand rawe_flagsas provider-neutral facts (anarmmetadata 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.ET_EXECwith EABI5 is admitted; hard-float (armhf) and unspecified float conventions are covered. ELF64, big-endianarmeb,EF_ARM_BE8mixed-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.-processor ARM:LE:32:v7with the default compiler spec through aprovider-pinned-v1selection; the bridge-reportedlanguage_idis checked against it after import (the DOSexpectedLanguageIdmechanism). A caller-selectedREA_GHIDRA_LANGUAGE_ID/REA_GHIDRA_COMPILER_SPEC_IDstill wins; combining the pin with an environment override is a typed refusal.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:
npm run verify:ghidra:arm: builds the source-owned fixture witharm-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 underARM: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.vitestsrc/ghidra/GhidraArmProfile.test.ts(admission, refusal matrix, pin read-back, caller-override precedence),src/domain/binaryTarget.test.ts, and the Ghidra suite pass;tsc --noEmitclean;oxlintreports no new warnings on the touched files.Author readiness
Human owner: @BaaRai