chore: integrate upstream verification fixture owners
Integrate repaired Ghidra installation fixtures and the shared CI report invocation owner. Remove the superseded local report-environment override. Preserve Windows caller-evidence content checks through retry/teardown and add the upstream distinct-object identity assertion. All ten PowerPC admission fixture tests and the original blob-report case pass with GITHUB_STEP_SUMMARY set; seven unrelated cases unselected. No real-Ghidra result is claimed from the fixture host. Original experiment files and measured runtime/data remain unchanged. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Kaoru0822
commit
502d531f68
@@ -235,7 +235,11 @@ async function verifyNativeValueAdapters(
|
||||
);
|
||||
assert.notEqual(comparison.isError, true, JSON.stringify(comparison));
|
||||
const comparisonEvidence = parseEvidence(comparison.structuredContent);
|
||||
assert.equal(comparisonEvidence.normalized_result.status, "unchanged");
|
||||
assert.equal(
|
||||
comparisonEvidence.normalized_result.status,
|
||||
"unchanged",
|
||||
JSON.stringify(comparisonEvidence.normalized_result.dimensions),
|
||||
);
|
||||
assert.deepEqual(
|
||||
comparisonEvidence.normalized_result,
|
||||
comparison.structuredContent?.normalized_result,
|
||||
|
||||
@@ -131,6 +131,25 @@ export async function verifyGhidraBoundaries(
|
||||
const externalDossier = await call("analyze_function", {
|
||||
procedure: external.address,
|
||||
});
|
||||
assert.equal(externalDossier.pseudocode, "");
|
||||
assert.deepEqual(externalDossier.assembly, []);
|
||||
assert.deepEqual(externalDossier.callees, []);
|
||||
assert.deepEqual(externalDossier.facet_availability.pseudocode, {
|
||||
available: false,
|
||||
reason: "Ghidra did not supply pseudocode.",
|
||||
});
|
||||
for (const facet of [
|
||||
"assembly",
|
||||
"comments",
|
||||
"callers",
|
||||
"callees",
|
||||
"references",
|
||||
"strings_names",
|
||||
"cfg",
|
||||
])
|
||||
assert.deepEqual(externalDossier.facet_availability[facet], {
|
||||
available: true,
|
||||
});
|
||||
const externalEntry = await call("resolve_containing_procedure", {
|
||||
address: external.address,
|
||||
});
|
||||
|
||||
@@ -10,6 +10,25 @@ interface StringExpectation {
|
||||
readonly recognitionOptional?: boolean;
|
||||
}
|
||||
|
||||
/** Verify native fragments against a complete, independently read source extent. */
|
||||
export function verifyHopperStringFragments(
|
||||
call: VerifierCall,
|
||||
inventory: readonly z.output<typeof analysisStringSchema>[],
|
||||
expectation: {
|
||||
readonly value: string;
|
||||
readonly symbol: string;
|
||||
readonly recognitionOptional?: boolean;
|
||||
},
|
||||
): Promise<{
|
||||
readonly sourceBytes: number;
|
||||
readonly recognition: {
|
||||
readonly address: string;
|
||||
readonly state: "observed" | "not_observed";
|
||||
readonly decodedObject: "verified" | "unverified";
|
||||
};
|
||||
readonly fragments: readonly z.output<typeof analysisStringSchema>[];
|
||||
}>;
|
||||
|
||||
/** Verify source bytes, observed decoding, address filters and literal searches. */
|
||||
export function verifyHopperStringObjects(
|
||||
call: VerifierCall,
|
||||
|
||||
@@ -106,27 +106,18 @@ async function verifySearchModes(call, address) {
|
||||
[{ address, value: "REA_Search_Upper" }],
|
||||
);
|
||||
const strings = await call("list_strings");
|
||||
const linux = process.platform === "linux";
|
||||
const fullLiteral = "REA_LONG_LITERAL_" + "x".repeat(4096) + "needle";
|
||||
// Recognition is a provider/loader capability, not an adapter guarantee.
|
||||
// Always retain the original size in raw-byte coverage; Linux additionally
|
||||
// requires an extent observed to produce native fragmented string objects.
|
||||
const fullBytes = Buffer.from(fullLiteral + "\0");
|
||||
const raw = await call("read_bytes", {
|
||||
address: `${fixtureSymbolPrefix}rea_long_literal`,
|
||||
length: fullBytes.length,
|
||||
const fullLiteral = await verifyHopperStringFragments(call, strings, {
|
||||
symbol: `${fixtureSymbolPrefix}rea_long_literal`,
|
||||
value: "REA_LONG_LITERAL_" + "x".repeat(4096) + "needle",
|
||||
recognitionOptional: true,
|
||||
});
|
||||
assert.equal(raw.complete, true);
|
||||
assert.equal(raw.bytes_hex, fullBytes.toString("hex"));
|
||||
const long = linux
|
||||
? "REA_FRAGMENTED_LITERAL_" + "x".repeat(512) + "fragment_tail"
|
||||
: fullLiteral;
|
||||
const longItem = strings.find(
|
||||
(item) => long.startsWith(item.value) && item.value.startsWith("REA_"),
|
||||
);
|
||||
assert.ok(longItem, "fixture omitted its real long literal");
|
||||
if (!linux) assert.equal(longItem.address, raw.address);
|
||||
assert.ok(long.startsWith(longItem.value));
|
||||
const fragmentedLiteral = await verifyHopperStringFragments(call, strings, {
|
||||
symbol: `${fixtureSymbolPrefix}rea_fragmented_literal`,
|
||||
value: "REA_FRAGMENTED_LITERAL_" + "x".repeat(512) + "fragment_tail",
|
||||
});
|
||||
const [longItem] = fragmentedLiteral.fragments;
|
||||
assert.ok(longItem, "fixture omitted its typed fragmented literal");
|
||||
assert.ok(fragmentedLiteral.fragments.length > 1);
|
||||
assert.ok(longItem.provider_value.endsWith("…"));
|
||||
assert.equal(longItem.string.termination, "missing");
|
||||
const literalProcedure = (await call("list_procedures")).find((item) =>
|
||||
@@ -154,33 +145,13 @@ async function verifySearchModes(call, address) {
|
||||
"function dossier discarded typed string provenance",
|
||||
);
|
||||
|
||||
const fragments = strings.filter((item) => {
|
||||
const offset = BigInt(item.address) - BigInt(longItem.address);
|
||||
return offset >= 0n && offset < BigInt(Buffer.byteLength(long));
|
||||
});
|
||||
assert.equal(fragments.map((item) => item.value).join(""), long);
|
||||
for (const fragment of fragments) {
|
||||
assert.equal(
|
||||
Buffer.byteLength(fragment.value),
|
||||
fragment.string.byte_length -
|
||||
(fragment.string.termination === "missing" ? 0 : 1),
|
||||
);
|
||||
const bytes = await call("read_bytes", {
|
||||
address: fragment.address,
|
||||
length: fragment.string.byte_length,
|
||||
});
|
||||
const expected = Buffer.from(
|
||||
fragment.value + (fragment.string.termination === "missing" ? "" : "\0"),
|
||||
);
|
||||
assert.equal(bytes.bytes_hex, expected.toString("hex"));
|
||||
}
|
||||
assert.deepEqual(
|
||||
await call("search_strings", {
|
||||
pattern: linux ? "fragment_tail" : "needle",
|
||||
pattern: "fragment_tail",
|
||||
mode: "literal",
|
||||
case_sensitive: true,
|
||||
}),
|
||||
[fragments.at(-1)],
|
||||
[fragmentedLiteral.fragments.at(-1)],
|
||||
);
|
||||
const expected = strings.filter((item) =>
|
||||
/^REA_C_(?:ENTRY|LEAF)$/u.test(item.value),
|
||||
@@ -201,7 +172,7 @@ async function verifySearchModes(call, address) {
|
||||
value: "REA_UTF8_é_😀",
|
||||
encoding: "utf-8",
|
||||
symbol: `${fixtureSymbolPrefix}rea_utf8_literal`,
|
||||
recognitionOptional: linux,
|
||||
recognitionOptional: true,
|
||||
},
|
||||
{ value: 'REA_ESCAPED_"\\line\nend\t\r', encoding: "utf-8" },
|
||||
{ value: "REA_LITERAL_BACKSLASH_\\n", encoding: "utf-8" },
|
||||
@@ -209,33 +180,90 @@ async function verifySearchModes(call, address) {
|
||||
value: "REA_LITERAL_…",
|
||||
encoding: "utf-8",
|
||||
symbol: `${fixtureSymbolPrefix}rea_ellipsis_literal`,
|
||||
recognitionOptional: linux,
|
||||
recognitionOptional: true,
|
||||
},
|
||||
{
|
||||
value: "REA_LATIN1_ÿ",
|
||||
encoding: "latin-1",
|
||||
symbol: `${fixtureSymbolPrefix}rea_latin1_literal`,
|
||||
recognitionOptional: linux,
|
||||
recognitionOptional: true,
|
||||
},
|
||||
],
|
||||
strings,
|
||||
);
|
||||
return {
|
||||
fullLiteralSourceBytes: fullBytes.length,
|
||||
fragmentedLiteralSourceBytes: Buffer.byteLength(long),
|
||||
fullLiteralRecognition: {
|
||||
address: raw.address,
|
||||
state: strings.some((item) => item.address === raw.address)
|
||||
? "observed"
|
||||
: "not_observed",
|
||||
// Linux validates the original through raw bytes; its required decoded
|
||||
// fragment/dossier checks exercise the separate supported-size literal.
|
||||
decodedObject: linux ? "unverified" : "verified",
|
||||
},
|
||||
fullLiteralSourceBytes: fullLiteral.sourceBytes,
|
||||
fragmentedLiteralSourceBytes: fragmentedLiteral.sourceBytes,
|
||||
fullLiteralRecognition: fullLiteral.recognition,
|
||||
...objects,
|
||||
};
|
||||
}
|
||||
|
||||
/** Bind native fragments to exact source bytes without assuming loader recognition. */
|
||||
export async function verifyHopperStringFragments(
|
||||
call,
|
||||
strings,
|
||||
{ symbol, value, recognitionOptional = false },
|
||||
) {
|
||||
const expectedBytes = Buffer.from(value + "\0");
|
||||
const raw = await call("read_bytes", {
|
||||
address: symbol,
|
||||
length: expectedBytes.length,
|
||||
});
|
||||
assert.equal(raw.complete, true);
|
||||
assert.equal(raw.bytes_hex, expectedBytes.toString("hex"));
|
||||
const start = BigInt(raw.address);
|
||||
const end = start + BigInt(expectedBytes.length);
|
||||
const fragments = strings.filter((item) => {
|
||||
const address = BigInt(item.address);
|
||||
return address >= start && address < end;
|
||||
});
|
||||
if (fragments.length === 0 && recognitionOptional)
|
||||
return {
|
||||
sourceBytes: expectedBytes.length,
|
||||
recognition: {
|
||||
address: raw.address,
|
||||
state: "not_observed",
|
||||
decodedObject: "unverified",
|
||||
},
|
||||
fragments,
|
||||
};
|
||||
assert.ok(fragments.length > 0, "fixture omitted its typed string fragments");
|
||||
let next = start;
|
||||
for (const [index, fragment] of fragments.entries()) {
|
||||
assert.equal(
|
||||
BigInt(fragment.address),
|
||||
next,
|
||||
"string fragments have a gap, overlap or wrong source identity",
|
||||
);
|
||||
const terminal = index === fragments.length - 1;
|
||||
assert.equal(
|
||||
fragment.string.termination,
|
||||
terminal ? "present_or_not_required" : "missing",
|
||||
);
|
||||
const expected = Buffer.from(fragment.value + (terminal ? "\0" : ""));
|
||||
assert.equal(fragment.string.byte_length, expected.length);
|
||||
const bytes = await call("read_bytes", {
|
||||
address: fragment.address,
|
||||
length: expected.length,
|
||||
});
|
||||
assert.equal(bytes.complete, true);
|
||||
assert.equal(bytes.bytes_hex, expected.toString("hex"));
|
||||
next += BigInt(expected.length);
|
||||
}
|
||||
assert.equal(next, end, "string fragments do not cover the source extent");
|
||||
assert.equal(fragments.map((item) => item.value).join(""), value);
|
||||
return {
|
||||
sourceBytes: expectedBytes.length,
|
||||
recognition: {
|
||||
address: raw.address,
|
||||
state: "observed",
|
||||
decodedObject: "verified",
|
||||
},
|
||||
fragments,
|
||||
};
|
||||
}
|
||||
|
||||
/** Compare native string identities and values with the source fixture's bytes. */
|
||||
export async function verifyHopperStringObjects(
|
||||
call,
|
||||
|
||||
@@ -327,14 +327,57 @@ export const analyzeFixtureProcedure = async (
|
||||
options,
|
||||
procedure,
|
||||
normalizedResult,
|
||||
) =>
|
||||
normalizedResult(
|
||||
) => {
|
||||
const reply = await client.callTool(
|
||||
{
|
||||
name: "analyze_function",
|
||||
arguments: { procedure: procedure.address },
|
||||
},
|
||||
options,
|
||||
);
|
||||
const dossier = normalizedResult(reply, "analyze_function");
|
||||
assert.deepEqual(reply.structuredContent.relationship_coverage, {
|
||||
status: "complete",
|
||||
});
|
||||
for (const facet of [
|
||||
"pseudocode",
|
||||
"assembly",
|
||||
"comments",
|
||||
"callers",
|
||||
"callees",
|
||||
"references",
|
||||
"strings_names",
|
||||
"cfg",
|
||||
])
|
||||
assert.deepEqual(dossier.facet_availability[facet], { available: true });
|
||||
const comparison = normalizedResult(
|
||||
await client.callTool(
|
||||
{
|
||||
name: "analyze_function",
|
||||
arguments: { procedure: procedure.address },
|
||||
name: "compare_functions",
|
||||
arguments: {
|
||||
left: reply.structuredContent,
|
||||
right: reply.structuredContent,
|
||||
},
|
||||
},
|
||||
options,
|
||||
),
|
||||
"analyze_function",
|
||||
"compare_functions",
|
||||
);
|
||||
assert.deepEqual(
|
||||
Object.fromEntries(
|
||||
comparison.dimensions.map(({ dimension, status }) => [dimension, status]),
|
||||
),
|
||||
{
|
||||
identity: "unchanged",
|
||||
pseudocode: "unchanged",
|
||||
assembly: "unchanged",
|
||||
comments: "unchanged",
|
||||
calls: "unchanged",
|
||||
references: "unknown",
|
||||
strings_names: "unchanged",
|
||||
cfg: "unchanged",
|
||||
},
|
||||
JSON.stringify(comparison.dimensions),
|
||||
);
|
||||
return dossier;
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ const verifyCurrentTarget = async (client, options) => {
|
||||
);
|
||||
return {
|
||||
procedure: dossier.procedure,
|
||||
procedureCount: procedures.total,
|
||||
procedureCount: procedures.length,
|
||||
boundedPseudocodeChars: boundedPseudocode.length,
|
||||
analyzedPseudocodeChars: [...dossier.pseudocode].length,
|
||||
callerCount: relationships.procedure_callers.length,
|
||||
|
||||
@@ -68,6 +68,7 @@ const retainedPath=path+'-retained';renameSync(path,retainedPath);
|
||||
assert.equal(statSync(retainedPath,{bigint:true}).ino,identity.ino);
|
||||
// FILE_SHARE_DELETE permits rename; ownership follows the retained handle.
|
||||
mkdirSync(path);const replacement=statSync(path,{bigint:true});
|
||||
assert.notEqual(replacement.ino,identity.ino);
|
||||
const marker=join(path,'caller-evidence.txt');writeFileSync(marker,'caller-owned replacement');
|
||||
if(process.argv[2]!=='teardown'){
|
||||
const second=systemWindowsNativeAuthority();assert.equal(second.available,true);
|
||||
|
||||
Reference in New Issue
Block a user