Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Raw Cortex-M firmware images can now be imported without treating their vector data as the code entry. Add an optional independent load base and an explicit Cortex/Thumb profile to the existing Ghidra raw-binary workflow.
Refs #4246. This draft offers a bounded, real-provider-verified Cortex-M use case for that discussion; it does not presume a maintainer decision on generic language passthrough.
Problem and expected behavior
The existing raw import maps file offset zero at
entry_pointand seeds a function there. This misinterprets images with leading data, while the generic ARM language is unsuitable for a Thumb-only Cortex-M image. The source-owned fixture here has vector data before its entry and an absolute data pointer.base_address/--base-addressnow selects the file mapping independently. Omission preserves the previous entry-based mapping.processor_variant: "cortex-m"/--processor-variant cortex-mexplicitly selectsARM:LE:32:Cortex; omitting the variant preserves generic ARM. Code entries must be even; odd Thumb function pointers are rejected rather than silently modified.Change and scope
Two commits separate the prerequisite load-address change from Cortex-M support. Admission owns validation/canonicalization; sessions, snapshots, profiles, CLI/MCP results and load-image attestation carry the same interpretation. Ghidra checks Thumb context before disassembly and reports it for independent attestation.
src/domain/rawBinary.ts, before provider selection.Expected effects:
Evidence and regression coverage
Executed on macOS arm64, Ghidra 12.1.2, full JDK 21, pinned Node 24.18.0/npm 11.16.0:
npm run verify:ghidra:raw— passed with real CLI/MCP, independent base/entry mappings, canonical reuse, different-base partitioning, ARM/x86/x86-64 controls, unchanged source bytes and complete cleanup.npm run verify:ghidra:cortex-m— passed with real CLI/MCP at zero and nonzero bases: Thumb context, call references, decompilation, source-offset lookup, odd-pointer rejection preserving the active session, generic ARM profile preservation, unchanged sources and complete cleanup.ok:true,mocked:false,cli_mcp_load_image_parity:true,thumb_context_verified:true,decompilation:true,cleanup:"complete". Both inputs are 100-byte source-owned Cortex-M0 fixtures; no vendor firmware is included.The base control reproduces the former import assumption; the implementation no longer seeds code at the mapping base when the caller selects a different entry. Missing or wrong observed Thumb context produces a load-image mismatch.
Validation performed
Revalidated on 2026-10-22 after merging upstream
b6007e0:npm run checkandnpm run check:ci— passed, including full formatting, typecheck, lint, knip, metadata, architecture guards, duplicate/TODO checks, discovery and 91 Python tests.npm run docs:check— passed, including 9 README consistency tests.npm run verify:test-discovery— 1,997 test files discovered exactly once.Upstream synchronization and prior CI failures
The two conflicts in
DirectAnalysis.tsandcli/options.tsare resolved by retaining upstream cancellation handling and the simplified CLI mapping, while forwarding the independent base and Cortex-M variant. A merge commit preserves the two existing contribution commits for ongoing human review.The earlier CI failures were the XML test formatting issue and a Linux prerequisite test whose restricted PATH hid
ps. Both upstream fixes are included via #4930 (1accac2). The prerequisite boundary test now passes locally; Linux Actions results remain separate evidence. No CI gate, assertion, timeout or workflow was weakened. At headebb58a2, the new CI run reportsaction_requiredwith no jobs started; upstream approval is still required. Current-head Linux Actions results are unverified.Compatibility and remaining proof gaps
Linux real-provider execution, Windows and Ghidra 12.1.4 were not exercised here. The fixture covers Cortex-M0 instructions, not every Cortex-M ISA variant, floating-point ABI or TrustZone. No reset/peripheral emulation, device memory-map discovery or automatic vector-table discovery is added. The caller supplies the load base and even code entry. This draft is not a claim that vendor firmware behavior or a physical device has been qualified.
Author readiness
Human owner: @jgranie