Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(ghidra): recover verified MIPS verifier provider survivors
Retry registered provider cleanup with the canonical ownership ledger and preserve the initial failure and recovery diagnostics.
  • Loading branch information
Bobtoshi committed Nov 13, 2026
commit 7d9257581d6812d82d013d0c10a5dc3c375c8a93
2 changes: 2 additions & 0 deletions docs/providers/ghidra-mips.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ 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.
A failed sweep triggers bounded recovery attempts using verified provider
ownership and retains their outcomes in the diagnostic workspace.

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.
Expand Down
32 changes: 24 additions & 8 deletions scripts/lib/verifier-token-cleanup.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import type {
ProcessOwnershipHost,
} from "../../src/process/ProcessOwnership.js";
import type { VerifierRunStart } from "./verifier-run.mjs";
import type { RetainedProcessOwnershipCandidate } from "../../src/process/ProcessOwnershipEvidence.js";

interface VerifierTokenCleanupResult {
readonly cleaned: boolean;
readonly reason?: string;
readonly runs: readonly {
readonly run_id: string;
readonly result: ProcessCleanupResult;
}[];
}

/** Capture the prelaunch identities used by the canonical, PPID-independent sweep. */
export function prepareVerifierTokenCleanup(
Expand All @@ -20,14 +30,20 @@ export function prepareVerifierTokenCleanup(
readonly sampledProcessGroupIds?: readonly number[];
},
): Promise<void>;
verify(): Promise<{
readonly cleaned: boolean;
readonly reason?: string;
readonly runs: readonly {
readonly run_id: string;
readonly result: ProcessCleanupResult;
}[];
}>;
verify(): Promise<VerifierTokenCleanupResult>;
/** Recover failed registered providers with canonical native ownership checks. */
retryProviderCleanup(
verification: VerifierTokenCleanupResult,
): Promise<VerifierTokenCleanupResult>;
retainedProviderEvidence(): readonly {
readonly run_id: string;
readonly candidates: readonly (Pick<
RetainedProcessOwnershipCandidate,
"pid" | "identity" | "applicability" | "relation"
> & {
readonly scope_evidence: RetainedProcessOwnershipCandidate["scopeEvidence"];
})[];
}[];
/** Retry a failed close on the same host and preserve any release failure. */
close(): Promise<void>;
}>;
152 changes: 117 additions & 35 deletions scripts/lib/verifier-token-cleanup.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { verifyNoTokenOwnedProcesses } from "../../dist/process/ProcessOwnership.js";
import {
cleanupOwnedProcessGroup,
verifyNoTokenOwnedProcesses,
} from "../../dist/process/ProcessOwnership.js";
import { ProcessOwnershipEvidenceOwner } from "../../dist/process/ProcessOwnershipEvidence.js";
import {
createSystemProcessOwnershipHost,
Expand Down Expand Up @@ -59,6 +62,53 @@ export async function prepareVerifierTokenCleanup(run, suppliedHost) {
},
],
]);
const discoverProviderScope = async (runId) => {
// A token carrier selects candidates; native identity and membership
// must agree across the token observation before anchoring a scope.
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" &&
!baseline.some(
({ pid, identity }) =>
pid === fact.process.pid &&
identity === fact.identityAfter.identity,
),
);
const first = facts[0];
if (first === undefined) return undefined;
return {
leaderPid: first.process.pid,
processGroupId: first.identityAfter.relation.processGroupId,
sampledProcessGroupIds: [
...new Set(
facts.map(
({ identityAfter }) => identityAfter.relation.processGroupId,
),
),
],
};
};
const retainRelation = (runId, scope) => {
const relation = relations.get(runId) ?? {
...scope,
evidenceOwner: new ProcessOwnershipEvidenceOwner(),
};
relations.set(runId, relation);
return relation;
};
const cleanupHost = {
...host,
signalGroup: (groupId, signal) => {
if (groupId === launcher.processGroupId)
throw new Error("Provider recovery cannot signal the verifier group");
host.signalGroup(groupId, signal);
},
};
return {
registerProviderRun: (runId) => {
if (typeof runId !== "string" || runId.length === 0)
Expand All @@ -76,41 +126,12 @@ export async function prepareVerifierTokenCleanup(run, suppliedHost) {
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",
const scope = providerScope ?? (await discoverProviderScope(runId));
if (scope === undefined)
throw new Error(
`No token-verified process ownership for provider run ${runId}`,
);
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 relation = retainRelation(runId, scope);
const active = await verifyNoTokenOwnedProcesses(
runId,
host,
Expand Down Expand Up @@ -142,6 +163,67 @@ export async function prepareVerifierTokenCleanup(run, suppliedHost) {
runs,
};
},
retryProviderCleanup: async (verification) => {
const runs = [];
for (const { run_id: runId, result } of verification.runs) {
if (result.cleaned || runId === run.run_id || !relations.has(runId))
Comment thread
Bobtoshi marked this conversation as resolved.
Resolved
continue;
try {
const scope =
host.processIdentities === undefined
? undefined
: (relations.get(runId) ??
(await discoverProviderScope(runId)));
const retry =
scope === undefined
? await verifyNoTokenOwnedProcesses(runId, host, baseline)
: await cleanupOwnedProcessGroup(
{
...retainRelation(runId, scope),
runId,
captureBaseline: baseline,
sweepTokenOwnedProcesses: true,
},
cleanupHost,
);
runs.push({ run_id: runId, result: retry });
} catch (cause) {
runs.push({
run_id: runId,
result: {
cleaned: false,
reason: cause instanceof Error ? cause.message : String(cause),
},
});
}
}
return { cleaned: runs.every(({ result }) => result.cleaned), runs };
},
retainedProviderEvidence: () =>
[...relations].flatMap(([runId, relation]) =>
runId === run.run_id || relation === undefined
? []
: [
{
run_id: runId,
candidates: relation.evidenceOwner.candidates.map(
({
pid,
identity,
applicability,
scopeEvidence,
relation,
}) => ({
pid,
identity,
applicability,
scope_evidence: scopeEvidence,
relation,
}),
),
},
],
),
close,
};
} catch (cause) {
Expand Down
33 changes: 29 additions & 4 deletions scripts/verify-real-ghidra-mips-boundaries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,35 @@ try {
}, [
async () => {
tokenCleanup = await cleanup.verify();
if (!tokenCleanup.cleaned)
throw new Error(
`Token cleanup unverified: ${JSON.stringify(tokenCleanup)}`,
);
if (tokenCleanup.cleaned) return;
const firstRetry = await cleanup.retryProviderCleanup(tokenCleanup);
const retries = [firstRetry];
if (!firstRetry.cleaned)
retries.push(await cleanup.retryProviderCleanup(firstRetry));
Comment thread
Bobtoshi marked this conversation as resolved.
Resolved
const diagnosticPath = join(root, "token-cleanup.json");
const failure = Object.assign(
new Error(
`Token cleanup unverified: ${tokenCleanup.reason}; diagnostic: ${diagnosticPath}`,
),
{ verification: tokenCleanup, retries },
);
await withVerifierCleanup(() => {
throw failure;
}, [
() =>
writeFile(
diagnosticPath,
JSON.stringify(
{
verification: tokenCleanup,
retries,
retained_provider_evidence: cleanup.retainedProviderEvidence(),
Comment thread
Bobtoshi marked this conversation as resolved.
Resolved
},
null,
2,
),
),
]);
},
cleanup.close,
async () => {
Expand Down
Loading