Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:38:08 +02:00
commit c737a37f71
531 files changed
+119270

No files matched your search

@@ -0,0 +1,63 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
import { fileURLToPath } from 'node:url';
import {
parseMailboxCaptures,
summarizeMailboxCaptures,
} from '../../scripts/autonomous/parse-kstuff-mailbox-capture.mjs';
const here = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(here, '../..');
test('verifyImage diagnostic patch is source-pinned and observe-only', () => {
const manifest = JSON.parse(fs.readFileSync(
path.join(root, 'tools/ps5-kstuff-diagnostics/verify-image-observability.json'),
'utf8',
));
const patch = fs.readFileSync(
path.join(root, 'tools/ps5-kstuff-diagnostics/verify-image-observability.patch'),
'utf8',
);
assert.equal(manifest.upstreamCommit, '3b2ab4a16ba43c8ab38daf7ec83cc297014e0e47');
assert.equal(manifest.observabilityOnly, true);
assert.equal(manifest.firmware, '9.60');
assert.match(patch, /KSTUFF_SYSCALL_NMOUNT/);
assert.match(patch, /observe_unhandled_mailbox/);
assert.match(patch, /mailbox_capture_copy_failures/);
assert.doesNotMatch(patch, /regs\[RAX\]\s*=/);
assert.doesNotMatch(patch, /regs\[RIP\]\s*=/);
assert.doesNotMatch(patch, /copy_to_kernel\s*\(/);
assert.doesNotMatch(patch, /register_fake_key\s*\(/);
});
test('parser retains exact request words and reports capture gaps', () => {
const parsed = parseMailboxCaptures(`
mailbox-capture[41] syscall=nmount lr=0xffffffff81234567 request=0xffff800001020000 copy=ok rdi=0x1 rsi=0x2 rcx=0x3 req0=0x10 req1=0x11 req2=0x12 req3=0x13 req4=0x14 req5=0x15 req6=0x16 req7=0x17
mailbox-capture-gap expected=42 actual=44 dropped=2
mailbox-capture[44] syscall=nmount lr=0xffffffff81234567 request=0xffff800001020000 copy=EFAULT rdi=0x1 rsi=0x2 rcx=0x3 req0=0x0 req1=0x0 req2=0x0 req3=0x0 req4=0x0 req5=0x0 req6=0x0 req7=0x0
`);
assert.equal(parsed.captures.length, 2);
assert.equal(parsed.captures[0].sequence, 41n);
assert.equal(parsed.captures[0].lr, 0xffffffff81234567n);
assert.deepEqual(parsed.captures[0].requestWords, [
0x10n, 0x11n, 0x12n, 0x13n, 0x14n, 0x15n, 0x16n, 0x17n,
]);
assert.equal(parsed.captures[1].copyStatus, 'EFAULT');
assert.deepEqual(parsed.gaps, [{ expected: 42n, actual: 44n, dropped: 2n }]);
const summary = summarizeMailboxCaptures(parsed);
assert.equal(summary.total, 2);
assert.equal(summary.uniqueReturnAddresses, 1);
assert.equal(summary.copyFailures, 1);
assert.equal(summary.dropped, 2n);
});
test('parser ignores unrelated debug-reader output', () => {
const parsed = parseMailboxCaptures('core handle=10\nfpkg verify=0 verify_emu=0\n');
assert.deepEqual(parsed, { captures: [], gaps: [] });
});