feat(ghidra): add DOS MZ analysis and complete function extents (#556)

Validate DOS MZ load modules and import them with Ghidra's 16-bit
real-mode profile. Preserve complete observed inclusive function body
ranges through inventory, function analysis, Evidence and snapshots.

Add a public source-generated DOS CLI/MCP verification lane and
regressions for malformed headers, body membership and cache profiles.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
This commit is contained in:
N0zoM1z0
2026-10-05 20:09:45 +08:00
committed by GitHub
parent 53fe7d6d3b
commit 4f099a10f8
55 changed files with 2206 additions and 92 deletions
@@ -36,7 +36,7 @@ const functionWorkflow = <Name extends FunctionWorkflowName>(
export const FUNCTION_WORKFLOW_TOOL_CONTRACTS = [
functionWorkflow(
"analyze_function",
"Build a dossier for one native function identified by symbol or provider-returned address. Returns identity, provider-specific pseudocode and assembly, comments, calls, references, referenced strings/names, local CFG blocks, and available native API boundary observations.",
"Build a dossier for one native function identified by symbol or provider-returned address. Returns identity with complete inclusive body ranges or explicit unknown, provider-specific pseudocode and assembly, comments, calls, references, referenced strings/names, local CFG blocks, and available native API boundary observations.",
),
functionWorkflow(
"inspect_native_api",
+1 -1
View File
@@ -225,7 +225,7 @@ export const OFFICIAL_TOOL_CONTRACTS = [
),
official(
"procedure_info",
"Return provider metadata for one procedure identified by symbol or address: entrypoint, signature, locals, size, and block count.",
"Return provider metadata for one procedure identified by symbol or address: entrypoint, signature, locals, size, block count, and complete inclusive body ranges when observed. Body byte count and enclosing span remain distinct; unavailable extent is explicit.",
z.object({ procedure, document }),
),
official(
@@ -5,6 +5,7 @@ import {
procedureIdentitySchema,
localVariableSchema,
functionDossierSchema,
functionBodySchema,
} from "../domain/hopperValues.js";
import { analysisProfileSchema } from "../domain/analysisProfile.js";
import { evidenceEnvelopeSchema } from "../domain/evidence.js";
@@ -49,6 +50,7 @@ export const targetFormatSchema = z.enum([
"mach-o",
"elf",
"pe",
"dos-mz",
"zip",
"ipa",
"apk",
@@ -467,6 +469,10 @@ export const procedureInfoOutput = resultOf(
signature: nullableText,
locals: z.array(localVariable),
classification: procedureClassificationSchema.nullable().default(null),
body: functionBodySchema.default({
available: false,
reason: "The provider did not report complete function body ranges.",
}),
}),
);