Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4de50d5
test(raw): pin raw-binary admission and identity
Entrpi Oct 27, 2026
893a023
refactor(raw): carry the raw load selection as one admitted value
Entrpi Oct 27, 2026
56f27b3
feat(raw): state the M-profile raw load contract
Entrpi Oct 27, 2026
f7b4496
feat(raw): admit M-profile loads at a separate base
Entrpi Oct 27, 2026
74b4a2c
feat(raw): give M-profile loads a versioned identity
Entrpi Oct 27, 2026
e1271f9
feat(ghidra): open M-profile loads at their base in Thumb state
Entrpi Oct 27, 2026
5962d2a
test(raw): check saved raw snapshots and schemas stay compatible
Entrpi Oct 27, 2026
6565d11
test(ghidra): verify M-profile raw loads against real Ghidra
Entrpi Oct 27, 2026
ea8ac34
feat(raw): add the armv8.1-m.main variant
Entrpi Oct 28, 2026
8bd006e
fix(ghidra): report Ghidra's ARMv8.1-M loop flow for armv8.1-m.main
Entrpi Oct 28, 2026
b45a7d4
test(ghidra): verify an ARMv8.1-M image against real Ghidra
Entrpi Oct 28, 2026
8d9e15a
refactor: name the variant vocabulary after architecture_variant
Entrpi Oct 28, 2026
63f2552
refactor(ghidra): keep variant decoder limitations beside the languages
Entrpi Oct 28, 2026
56a0587
fix(raw): require base_address with every architecture_variant
Entrpi Oct 28, 2026
808240d
fix(raw): align vector tables as VTOR does and refuse Reset inside them
Entrpi Oct 28, 2026
3bded52
fix(ghidra): key variant coordinates by base, not entry
Entrpi Oct 28, 2026
8315acc
refactor(raw): discriminate the segments load image by layout
Entrpi Oct 28, 2026
a2decdd
docs(raw): record why vector-table words keep their full width
Entrpi Oct 28, 2026
404b60f
docs(raw): record why the seeded entry function is named entry
Entrpi Oct 28, 2026
b381a01
fix(raw): name the refused load input in error details
Entrpi Oct 28, 2026
58ab75f
docs(raw): state that results keep no caller spellings yet
Entrpi Oct 28, 2026
3c4e4f5
docs(raw): explain why reused sessions cannot report stale vector words
Entrpi Oct 28, 2026
891a731
docs(raw): scope architecture_variant to the ARM M profiles
Entrpi Oct 28, 2026
3bc15c9
docs(raw): state each load pairing rule once in open_binary
Entrpi Oct 28, 2026
26cac3d
refactor(ghidra): let session limitations own the variant load facts
Entrpi Oct 28, 2026
33f1d13
refactor(ghidra): launch with the label policy the profile committed
Entrpi Oct 28, 2026
58c7e88
refactor(raw): let the vector-table read carry its length
Entrpi Oct 28, 2026
d7622e8
test(raw): compare saved raw images by their facts, not their prose
Entrpi Oct 28, 2026
36e0908
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 28, 2026
d708eb4
test(ghidra): expect not-in-listing where the Cortex-M lane stops
Entrpi Oct 28, 2026
beaa182
test(raw): pin raw identity to main after its instruction-status revi…
Entrpi Oct 28, 2026
1b55c3a
test(ghidra): own the Cortex-M lane's LLVM and CLI commands
Entrpi Oct 29, 2026
a7451a0
test(raw): derive the Reset fixtures from one Thumb image
Entrpi Oct 29, 2026
bd985a4
docs(raw-binary): say that recording load spellings would not be addi…
Entrpi Oct 29, 2026
4731755
docs(raw-binary): tell callers how to keep their load spellings
Entrpi Oct 29, 2026
c943559
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 29, 2026
13906c5
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 29, 2026
a1c564e
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 31, 2026
8745130
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
93cde07
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
54d4d33
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
b250be1
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 4, 2026
18c8965
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
8aec915
test(ghidra): keep raw digests at main's byte-search and data-type re…
Entrpi Nov 5, 2026
8b78936
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
a0717a6
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
f45a6ca
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
63b4fc8
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
46a8db4
test(domain): check raw-binary refusal facts, not sentences
Entrpi Nov 7, 2026
1238961
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
b82751a
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
7b4d25e
docs(adr): move the M-profile raw load decision into an ADR
Entrpi Nov 7, 2026
9251826
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 8, 2026
7c9d321
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 8, 2026
79ae54d
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 9, 2026
526c456
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 9, 2026
f0c95ab
test(ghidra): repin digests and replay for main's call-coverage revision
Entrpi Nov 9, 2026
ec36dc9
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
68fa04d
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
8ae3b4e
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
ca775e7
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 11, 2026
69fb296
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 11, 2026
3760d36
chore(plugin): regenerate the skill bundle from the authored skill
Entrpi Nov 11, 2026
f032197
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 14, 2026
da137b0
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 14, 2026
cf445aa
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 21, 2026
9d7ab2c
test(raw): keep the target route diagnostics within the function leng…
Entrpi Nov 22, 2026
dd59ab0
docs(raw): record the M-profile lane on Ghidra 12.2
Entrpi Nov 22, 2026
583ecb7
refactor(raw): read vector words and own the Cortex-M workspace throu…
Entrpi Nov 22, 2026
0edf352
fix(raw): name raw-binary as the format of vector-table read failures
Entrpi Nov 22, 2026
207631c
fix(verify): remove the Cortex-M workspace after a verified run
Entrpi Nov 22, 2026
35fbcb8
chore(verify): record open_binary's input schema with the M-profile l…
Entrpi Nov 22, 2026
3d8e5c3
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
f6415fe
test(cli): expect open_binary's M-profile load flags in the CLI comma…
Entrpi Nov 22, 2026
c8a68a4
test(cli): record the CLI help goldens with the M-profile load flags
Entrpi Nov 22, 2026
0a66d7c
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
14bce8e
docs(raw-binary): qualify snapshot replay under the producer rule
Entrpi Nov 22, 2026
b660ef4
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
77d14bd
test(ghidra): report why Cortex-M verifier cleanup could not be checked
Entrpi Nov 22, 2026
5ecb56d
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
db9bc1d
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
07f639c
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
4f29527
fix(domain): compare raw-load functions by coordinates, not entry pro…
Entrpi Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(ghidra): own the Cortex-M lane's LLVM and CLI commands
The lane's LLVM oracle ran clang and llvm-objdump through execFile with
no deadline, and its CLI parity launch used execFile directly, so a
hung tool could stall the lane and a killed one could leave children
behind. All three now run through createVerifierCommands, the owner
that stops each process tree, with a 120-second deadline for LLVM and
240 seconds for the CLI, as the ESP image verifier does.

The oracle writes under the lane's workspace instead of its own
temporary directory, and the lane closes the owner before removing that
workspace; a failed close keeps it for inspection.
  • Loading branch information
Entrpi committed Oct 29, 2026
commit 1b55c3a1d1de2a876fe37bbe51225b4af6d336f7
76 changes: 41 additions & 35 deletions scripts/lib/llvm-thumb-oracle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
// llvm-objdump gives the mnemonic at each instruction offset. Data the source
// declares (an ARM `$d` mapping symbol) is not an instruction.
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { mkdtemp, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { promisify } from "node:util";

const run = promisify(execFile);
/** Deadline and per-stream output capacity of each LLVM command. */
const LLVM_COMMAND = { maxBuffer: 16 * 1024 * 1024, timeout: 120_000 };

/** Bytes of the `.text` section of a little-endian ELF32 relocatable object. */
const elf32Text = (object) => {
Expand Down Expand Up @@ -41,54 +39,62 @@ const elf32Text = (object) => {
* `fixture.floatAbi` when it names them, and require its bytes to equal
* `fixture.code`. Returns LLVM's mnemonic for each instruction, keyed by image
* offset.
*
* `llvm.commands` is the caller's verifier command owner: each tool runs as an
* owned process tree with a deadline. The files go in a new directory under
* `llvm.workspace`, which the caller removes after closing that owner.
*/
export const llvmThumbMnemonics = async (fixture, tools) => {
const workspace = await mkdtemp(join(tmpdir(), "rea-thumb-oracle-"));
export const llvmThumbMnemonics = async (fixture, llvm) => {
const directory = await mkdtemp(join(llvm.workspace, "thumb-oracle-"));
// Optional extensions such as MVE are enabled by the CPU, not the triple.
const cpu = (flag) =>
fixture.cpu === undefined ? [] : [`${flag}=${fixture.cpu}`];
// clang 19 refuses MVE under the default soft-float ABI.
const floatAbi =
fixture.floatAbi === undefined ? [] : [`-mfloat-abi=${fixture.floatAbi}`];
try {
const source = join(workspace, "fixture.s");
const object = join(workspace, "fixture.o");
await writeFile(source, fixture.source);
await run(tools.clang, [
const source = join(directory, "fixture.s");
const object = join(directory, "fixture.o");
await writeFile(source, fixture.source);
await llvm.commands.exec(
llvm.clang,
[
`--target=${fixture.triple}`,
...cpu("-mcpu"),
...floatAbi,
"-c",
source,
"-o",
object,
]);
assert.equal(
elf32Text(await readFile(object)).toString("hex"),
fixture.code,
`LLVM assembles ${fixture.triple} source to different bytes`,
);
const { stdout } = await run(tools.objdump, [
],
LLVM_COMMAND,
);
assert.equal(
elf32Text(await readFile(object)).toString("hex"),
fixture.code,
`LLVM assembles ${fixture.triple} source to different bytes`,
);
const { stdout } = await llvm.commands.exec(
llvm.objdump,
[
"-d",
"--no-show-raw-insn",
`--triple=${fixture.triple}`,
...cpu("--mcpu"),
object,
]);
const mnemonics = new Map();
for (const line of stdout.split("\n")) {
// `offset:` then data bytes, if any, then a tab and the mnemonic or,
// for data, a directive such as `.short`.
const match = /^\s*([0-9a-f]+):[^\t]*\t(\.?[a-z][a-z0-9.]*)/u.exec(line);
if (match !== null && !match[2].startsWith("."))
mnemonics.set(
fixture.codeOffset + Number.parseInt(match[1], 16),
match[2],
);
}
assert.ok(mnemonics.size > 0, "llvm-objdump reported no instructions");
return mnemonics;
} finally {
await rm(workspace, { recursive: true, force: true });
],
LLVM_COMMAND,
);
const mnemonics = new Map();
for (const line of stdout.split("\n")) {
// `offset:` then data bytes, if any, then a tab and the mnemonic or, for
// data, a directive such as `.short`.
const match = /^\s*([0-9a-f]+):[^\t]*\t(\.?[a-z][a-z0-9.]*)/u.exec(line);
if (match !== null && !match[2].startsWith("."))
mnemonics.set(
fixture.codeOffset + Number.parseInt(match[1], 16),
match[2],
);
}
assert.ok(mnemonics.size > 0, "llvm-objdump reported no instructions");
return mnemonics;
};
35 changes: 20 additions & 15 deletions scripts/verify-real-ghidra-cortex-m.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Real-Ghidra lane for ARM M-profile raw images (architecture_variant,
// base_address, vector_table_address). Adapted from #4927 by Jean Granié.
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { createHash } from "node:crypto";
import {
mkdir,
Expand All @@ -14,7 +13,6 @@ import {
import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { promisify } from "node:util";

import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
Expand Down Expand Up @@ -42,6 +40,7 @@ import {
requireMcpToolError,
} from "./lib/mcp-verifier-results.mjs";
import { createVerifierRun, completeVerifierRun } from "./lib/verifier-run.mjs";
import { createVerifierCommands } from "./lib/verify-commands.mjs";

if (process.argv.length !== 2)
throw new Error("Usage: node scripts/verify-real-ghidra-cortex-m.mjs");
Expand All @@ -61,23 +60,18 @@ const installation = await inspectVerifierGhidraInstallation({
: { javaHome: process.env.JAVA_HOME }),
});
assert.equal(installation.status, "available", JSON.stringify(installation));
const run = createVerifierRun();
// Every LLVM and CLI command runs as an owned process tree with a deadline.
const commands = await createVerifierCommands();
const workspace = await mkdtemp(join(tmpdir(), "rea-cortex-m-proof-"));
// LLVM is the independent decoding oracle for every fixture.
const llvm = {
clang: process.env.REA_CLANG ?? "clang",
objdump: process.env.REA_LLVM_OBJDUMP ?? "llvm-objdump",
commands,
workspace,
};
const oracle = new Map();
for (const source of [
CORTEX_M0_SOURCE,
THUMB2_SOURCE,
V8M_BASELINE_SOURCE,
V8M_MSPLIM_SOURCE,
CORTEX_M55_SOURCE,
])
oracle.set(source, await llvmThumbMnemonics(source, llvm));

const run = createVerifierRun();
const workspace = await mkdtemp(join(tmpdir(), "rea-cortex-m-proof-"));
const runtime = join(workspace, "runtime");
await mkdir(runtime);
const entrypoint = fileURLToPath(new URL("./rea.mjs", import.meta.url));
Expand Down Expand Up @@ -112,6 +106,14 @@ const hex = (value) => `0x${value.toString(16)}`;
const word = (value) => `0x${value.toString(16).padStart(8, "0")}`;
let report;
try {
for (const source of [
CORTEX_M0_SOURCE,
THUMB2_SOURCE,
V8M_BASELINE_SOURCE,
V8M_MSPLIM_SOURCE,
CORTEX_M55_SOURCE,
])
oracle.set(source, await llvmThumbMnemonics(source, llvm));
await client.connect(transport);
const cases = [];
for (const base of [0, 0x08000000])
Expand Down Expand Up @@ -214,6 +216,9 @@ try {
} finally {
await client.close();
await transport.close();
// Remove the workspace only after every owned command tree has stopped; a
// failed close keeps it for inspection.
await commands.close();
await rm(workspace, { recursive: true, force: true });
}
const verifierRun = await completeVerifierRun(run);
Expand Down Expand Up @@ -496,7 +501,7 @@ async function verifyOddEntryAndCli(fixture, selection, image, path) {
const cli = parseEvidence(
JSON.parse(
(
await promisify(execFile)(
await commands.exec(
process.execPath,
[
entrypoint,
Expand All @@ -515,7 +520,7 @@ async function verifyOddEntryAndCli(fixture, selection, image, path) {
"ghidra",
"--json",
],
{ env, timeout: 240000, maxBuffer: 16 * 1024 * 1024 },
{ env, timeout: 240_000, maxBuffer: 16 * 1024 * 1024 },
)
).stdout,
),
Expand Down