From 60e07feef401d9044db3a1c925cb9d1f6d20dac9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 23:46:02 -0300 Subject: canim: relations as one data-oriented subsystem; aim; the ASan pair; the introduction's chapters From the user. Relations between panes are one subsystem: per-frame tables of places and values in struct-of-arrays, owned by the frame; the kinds one table of data; a resolver of pure passes (join, filter, priority, cut) unit-tested on hand-written tables. Ported kinds draw byte-identical frames; a synthetic map of 4000 places and 6000 values resolves in 0.56 ms against the old table's 5.7. aim, a word holding a code address tied to its row, is the first new kind, off unless a scene turns it on. The ASan pair: one overflow built plain and with ASan, recorded by instruction; the frame as bytes eight a row; the plain run goes on alone in the column, its return address aimed at main's row until the letters reach it; the fault at ret. The introduction's three chapters are built and tested, not yet exported. Annotations, rows and scrolls that changed in one frame now fade; captions stand twelve seconds at most. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- anim/test/asan.script | 10 ++++++++++ anim/test/intro_code.script | 12 ++++++++++++ anim/test/intro_memory.script | 13 +++++++++++++ anim/test/intro_stack.script | 10 ++++++++++ anim/test/recordings.zig | 25 +++++++++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 anim/test/asan.script create mode 100644 anim/test/intro_code.script create mode 100644 anim/test/intro_memory.script create mode 100644 anim/test/intro_stack.script (limited to 'anim/test') diff --git a/anim/test/asan.script b/anim/test/asan.script new file mode 100644 index 0000000..db1dc2c --- /dev/null +++ b/anim/test/asan.script @@ -0,0 +1,10 @@ +# The ASan pair, headless: it runs to three instants of its timeline without failing +# (the two runs together, plain alone with ASan stopped on its report, the close). +frames 2 +console set playing false +console set t 20 +screenshot .zig-cache/canim/asan-early.png +console set t 70 +screenshot .zig-cache/canim/asan-mid.png +console set t 999 +screenshot .zig-cache/canim/asan-end.png diff --git a/anim/test/intro_code.script b/anim/test/intro_code.script new file mode 100644 index 0000000..58811a4 --- /dev/null +++ b/anim/test/intro_code.script @@ -0,0 +1,12 @@ +# The introduction's third chapter, headless: it runs to four instants of its +# timeline without failing (the bytes decoded, the two forms, the working frame, the map). +frames 2 +console set playing false +console set t 8 +screenshot .zig-cache/canim/intro_code-decode.png +console set t 20 +screenshot .zig-cache/canim/intro_code-columns.png +console set t 30 +screenshot .zig-cache/canim/intro_code-frame.png +console set t 999 +screenshot .zig-cache/canim/intro_code-end.png diff --git a/anim/test/intro_memory.script b/anim/test/intro_memory.script new file mode 100644 index 0000000..a36d36a --- /dev/null +++ b/anim/test/intro_memory.script @@ -0,0 +1,13 @@ +# The introduction's first chapter, headless: it runs to four instants of its +# timeline without failing (the bytes regrouping, the address space enlarged, +# the dump tied to its place, the close). +frames 2 +console set playing false +console set t 14 +screenshot .zig-cache/canim/intro_memory-words.png +console set t 40 +screenshot .zig-cache/canim/intro_memory-segments.png +console set t 50 +screenshot .zig-cache/canim/intro_memory-place.png +console set t 999 +screenshot .zig-cache/canim/intro_memory-end.png diff --git a/anim/test/intro_stack.script b/anim/test/intro_stack.script new file mode 100644 index 0000000..7bb93ca --- /dev/null +++ b/anim/test/intro_stack.script @@ -0,0 +1,10 @@ +# The introduction's second chapter, headless: it runs to three instants of +# its timeline without failing (the words becoming the stack, the push, the close). +frames 2 +console set playing false +console set t 2 +screenshot .zig-cache/canim/intro_stack-become.png +console set t 6 +screenshot .zig-cache/canim/intro_stack-push.png +console set t 999 +screenshot .zig-cache/canim/intro_stack-end.png diff --git a/anim/test/recordings.zig b/anim/test/recordings.zig index 5f9ceb3..31cefdb 100644 --- a/anim/test/recordings.zig +++ b/anim/test/recordings.zig @@ -341,3 +341,28 @@ test "the source follows the pc into musl's own files and back to main's line" { for (files) |seen| try expect(seen); try expect(back); } + +test "the pair's runs: plain faults at its ret on the letters; ASan stops at the first byte past buf, its shadow f3" { + const plain = canim.open(recordings.overflow); + const asan = canim.open(recordings.overflow_asan); + const report = canim.open(recordings.overflow_report); + var buf: [256]u8 = undefined; + // Plain: the run ends at a `ret` whose return address is all letters (the signal's stop, rip still on it). + var last = plain.end() - 1; + while (last > 0) : (last -= 1) { + const here = plain.instruction(last, plain.register(last, "rip"), &buf) orelse continue; + if (std.mem.eql(u8, here.text, "ret")) break; + } + try expectEqual(@as(?u64, 0x4141414141414141), try canim.Recording.word(plain.moment(last), plain.register(last, "rsp"), 8)); + // ASan: its last moment is the report's first instruction, rdi the byte past buf: f3; buf's last byte addressable. + const at = asan.end() - 1; + const past = asan.register(at, "rdi"); + try expectEqual(@as(?u8, 0xf3), (try canim.ztrace.telescope.shadow(asan.moment(at), past)).?.value); + try expectEqual(@as(?u8, 0), (try canim.ztrace.telescope.shadow(asan.moment(at), past - 1)).?.value); + // Its report, as written to fd 2, names it; the run exits 1. + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const said = canim.pair.Report.stderr(report, arena.allocator()); + try expect(std.mem.indexOf(u8, said, "stack-buffer-overflow") != null); + try expectEqual(@as(?u64, 1), canim.pair.Report.status(report)); +} -- cgit v1.3