Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5df5571
feat(ghidra): admit verified recordless MIPS I o32 executables
Bobtoshi Oct 13, 2026
d8630ea
test(ghidra): verify MIPS branch decoding and retain diagnostics
Bobtoshi Oct 13, 2026
5ec1a57
fix(mips)!: reject uninspected GNU ABI attributes
Bobtoshi Oct 13, 2026
102f813
test(mips): isolate native boundary controls from ambient settings
Bobtoshi Oct 13, 2026
05e2366
test(mips): verify cleanup and pin readelf locale
Bobtoshi Oct 13, 2026
0a8f70f
Merge latest upstream and verify MIPS declaration coverage
Bobtoshi Oct 14, 2026
e389016
chore: preserve untouched upstream tests after merge
Bobtoshi Oct 14, 2026
2d2f2f8
test(ghidra): refresh MIPS controls and verify orphan cleanup
Bobtoshi Nov 6, 2026
11edd85
fix(verification): sweep the captured Ghidra provider run identities
Bobtoshi Nov 6, 2026
3569da2
chore: merge upstream into MIPS verifier branch
Bobtoshi Nov 8, 2026
7ab92a4
test(ghidra): verify imported MIPS languages and merge upstream
Bobtoshi Nov 10, 2026
6886262
test(ghidra): remove an empty processor context suite
Bobtoshi Nov 10, 2026
a830a4a
fix(ghidra): track verifier runs before lazy analysis
Bobtoshi Nov 11, 2026
624b879
fix(ghidra): verify MIPS evidence and preserve cleanup failures
Bobtoshi Nov 11, 2026
779a635
test(ghidra): verify committed MIPS dossier attribution
Bobtoshi Nov 13, 2026
19a9f98
fix(ghidra): bound MIPS readelf verification
Bobtoshi Nov 13, 2026
0a5b082
test(ghidra): bind MIPS dossiers to their ELF fixtures
Bobtoshi Nov 13, 2026
2d1ee37
test(ghidra): retain MIPS readelf verification evidence
Bobtoshi Nov 13, 2026
7494b2b
test(ghidra): retain MIPS source paths and refusal diagnostics
Bobtoshi Nov 13, 2026
99b9126
fix(ghidra): own MIPS verifier CLI refusal commands
Bobtoshi Nov 13, 2026
7d92575
fix(ghidra): recover verified MIPS verifier provider survivors
Bobtoshi Nov 13, 2026
dbd04ab
test(ghidra): verify recordless MIPS caveats and cold cleanup
Bobtoshi Nov 13, 2026
ffcd4d6
fix(ghidra): own the MIPS verifier MCP transport
Bobtoshi Nov 13, 2026
3596755
fix(ghidra): keep MIPS MCP ownership separate from CLI commands
Bobtoshi Nov 13, 2026
1051072
Qualify MIPS32 boundaries and retain failed verifier ownership
Bobtoshi Nov 13, 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
19 changes: 19 additions & 0 deletions docs/providers/ghidra-mips.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ PSP/Allegrex has a [separate static-ELF profile](ghidra-psp.md) tracked in

## Admission boundary

After building, `node scripts/verify-real-ghidra-mips-boundaries.mjs` checks both
byte orders through production CLI/MCP. GNU readelf independently decodes the
soft-float attribute fixture; declared-o32 MIPS I and unsupported GNU soft-float
inputs are refused, while recordless MIPS I and MIPS32 controls produce real
Ghidra dossiers and exact loaded bytes. The verifier checks the imported
`MIPS:LE:32:default` and `MIPS:BE:32:default` language IDs through
`inspect_native_load_image` and records the observed ID for each control.
It checks each public dossier against the exact MIPS ELF fixture digest and
entry address, and verifies the Ghidra version, committed support lane, and
inferred o32 ABI basis in its Evidence. The MIPS I Evidence must also
report the generic decoder's instruction-subset limitation. Load-delay semantics
remain unverified. Supply existing Ghidra/Java and GNU readelf
(`REA_MIPS_READELF`). Source hashes are checked after inspection, and no target
is executed. Cleanup checks process lineage and an independent run-token
sweep. The verifier registers each provider run ID from `binary_session`
before the first analysis call and retains live ownership facts after successful
analysis. Ghidra uses that session ID as its process token, so the sweep can
detect a reparented engine even when analysis fails.

ELF `EM_MIPS` is retained as the provider-neutral `mips` family. The target also
retains class, byte order, `e_type`, raw `e_flags`, and inspected ABI declarations.
Recognition does not mean every provider or MIPS variant is supported. Existing
Expand Down
1 change: 1 addition & 0 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"scripts/verify/analysis/source-location-delivery/task.mjs",
"scripts/verify/termux/browser.mjs",
"scripts/verify-real-ghidra-noreturn.mjs",
"scripts/verify-real-ghidra-mips-boundaries.mjs",
"scripts/verify-real-ghidra-decompiler-failure.mjs",
"scripts/verify-real-ghidra-decompile-timeout.mjs",
"scripts/verify-real-ghidra-function-bundle.mjs",
Expand Down
33 changes: 33 additions & 0 deletions scripts/lib/verifier-token-cleanup.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type {
ProcessCleanupResult,
ProcessOwnershipHost,
} from "../../src/process/ProcessOwnership.js";
import type { VerifierRunStart } from "./verifier-run.mjs";

/** Capture the prelaunch identities used by the canonical, PPID-independent sweep. */
export function prepareVerifierTokenCleanup(
run: VerifierRunStart,
suppliedHost?: ProcessOwnershipHost,
): Promise<{
/** Register a validated provider run ID before any operation can start it. */
registerProviderRun(runId: string): void;
/** Retain verified live ownership for a registered provider run. */
retainProviderRun(
runId: string,
providerScope?: {
readonly leaderPid: number;
readonly processGroupId: number;
readonly sampledProcessGroupIds?: readonly number[];
},
): Promise<void>;
verify(): Promise<{
readonly cleaned: boolean;
readonly reason?: string;
readonly runs: readonly {
readonly run_id: string;
readonly result: ProcessCleanupResult;
}[];
}>;
/** Retry a failed close on the same host and preserve any release failure. */
close(): Promise<void>;
}>;
152 changes: 152 additions & 0 deletions scripts/lib/verifier-token-cleanup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import { verifyNoTokenOwnedProcesses } from "../../dist/process/ProcessOwnership.js";
import { ProcessOwnershipEvidenceOwner } from "../../dist/process/ProcessOwnershipEvidence.js";
import {
createSystemProcessOwnershipHost,
readProcessOwnershipFacts,
} from "../../dist/process/ProcessOwnershipObservation.js";
import { readRunTokenCarriers } from "../../dist/process/ProcessRunTokenObservations.js";
import { withVerifierCleanup } from "./verifier-cleanup.mjs";

class VerifierOwnershipCleanupError extends AggregateError {
constructor(firstFailure, retryFailure, cleanupOwner) {
super(
[firstFailure, retryFailure],
"Verifier process ownership inspector cleanup is incomplete",
{ cause: firstFailure },
);
this.name = "VerifierOwnershipCleanupError";
this.cleanupOwner = cleanupOwner;
}
}

/** Capture the prelaunch identities used by the canonical, PPID-independent sweep. */
export async function prepareVerifierTokenCleanup(run, suppliedHost) {
const host = suppliedHost ?? createSystemProcessOwnershipHost();
const close = async () => {
try {
await host.close?.();
} catch (firstFailure) {
// Retry the native reader's retained helper and cache ownership.
try {
await host.close?.();
} catch (retryFailure) {
throw new VerifierOwnershipCleanupError(
firstFailure,
retryFailure,
host,
);
}
throw firstFailure;
}
};
try {
await host.prepare?.();
const baseline = await host.captureBaseline?.();
if (baseline === undefined)
throw new Error("Verifier process ownership baseline is unavailable");
const launcher = (await host.listProcesses()).find(
({ pid }) => pid === run.verifier_pid,
);
if (launcher === undefined)
throw new Error("Verifier launcher is absent from the process snapshot");
const relations = new Map([
[
run.run_id,
{
leaderPid: run.verifier_pid,
processGroupId: launcher.processGroupId,
evidenceOwner: new ProcessOwnershipEvidenceOwner(),
},
],
]);
return {
registerProviderRun: (runId) => {
if (typeof runId !== "string" || runId.length === 0)
throw new Error("Provider run ownership receipt is unavailable");
if (runId === run.run_id)
throw new Error(
"Provider receipt must identify its own run, not the verifier run",
);
if (relations.has(runId))
throw new Error(`Provider run ${runId} is already registered`);
// The run can be known before its lazy launcher starts. An unscoped
// canonical sweep checks its token without assuming wrapper ancestry.
relations.set(runId, undefined);
},
retainProviderRun: async (runId, providerScope) => {
if (!relations.has(runId) || runId === run.run_id)
throw new Error(`Provider run ${runId} was not registered`);
if (providerScope === undefined) {
// Discovery proves presence only. Identity/token/identity reads then
// establish scope anchors; the final canonical sweep proves cleanup.
const carriers = await readRunTokenCarriers(host, runId);
const facts = (
await readProcessOwnershipFacts(carriers, host)
).filter(
(fact) =>
fact.state === "same-generation" &&
fact.token.state === "readable" &&
fact.token.runId === runId &&
fact.identityAfter.state === "readable" &&
fact.identityAfter.relation?.state === "observed",
);
if (facts.length === 0)
throw new Error(
`No token-verified process ownership for provider run ${runId}`,
);
providerScope = {
leaderPid: facts[0].process.pid,
processGroupId: facts[0].identityAfter.relation.processGroupId,
sampledProcessGroupIds: [
...new Set(
facts.map(
({ identityAfter }) => identityAfter.relation.processGroupId,
),
),
],
};
}
const relation = relations.get(runId) ?? {
...providerScope,
evidenceOwner: new ProcessOwnershipEvidenceOwner(),
};
relations.set(runId, relation);
const active = await verifyNoTokenOwnedProcesses(
runId,
host,
baseline,
relation,
);
if (relation.evidenceOwner.coverage.retainedOwned === 0)
throw new Error(
`No token-verified process ownership for provider run ${runId}: ${JSON.stringify(active)}`,
);
},
verify: async () => {
const runs = [];
for (const [runId, relation] of relations) {
runs.push({
run_id: runId,
result: await verifyNoTokenOwnedProcesses(
runId,
host,
baseline,
relation,
),
});
}
const failed = runs.find(({ result }) => !result.cleaned);
return {
cleaned: failed === undefined,
...(failed === undefined ? {} : { reason: failed.result.reason }),
runs,
};
},
close,
};
} catch (cause) {
return withVerifierCleanup(() => {
throw cause;
}, [close]);
}
}
Loading