summaryrefslogtreecommitdiff
path: root/core/rollback.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 22:59:15 -0300
committerGabriel Schneider <[email protected]>2026-11-20 22:59:15 -0300
commitbf01716960a928b533c99ec9b373e35456ef18ba (patch)
tree09d74ec81e1662c3d20ff399c1f0042cceb9a108 /core/rollback.zig
parent4e1432049765be6e793a3834c93c4cd5318e82bc (diff)
parent1ae6addf4590d3b9c1070f6546c29e807d272491 (diff)
downloadpardes-bf01716960a928b533c99ec9b373e35456ef18ba.tar.gz
pardes-bf01716960a928b533c99ec9b373e35456ef18ba.zip
integration: the client's double free fixed, on the typed slot fields: pardes-client-abort (a 9P open record past fs.opens_len is nothing: never read or freed: a replica client's rollback left one with freed pointers and the open's replay freed them again: a client typing while a script held a pty/run aborted with a corrupted heap, since pardes-merge40; the rollback copy walks every type that declares replica: it skipped fs.Namespace and a pane's 9P state) and pardes-merge43; no conflict; gated whole against sketchbook's main (reorg/merge44): tui core-test 875/1033 (158 skipped), shell-test 1075/1078, addon-test 5/5, term-test 17/17, kitty-test 45/45, pane-test 183/184, behaviour-test 275/275 and with --replay, process-test 0 of 145 failed, consumer-test passes; both soaks (--clients 5 and --bytes) diverged 0, unequal 0, unlisted stops 0, corpus through a client 22 scenes the same; daemon.py plain, far, games, window-clients, clients five times, relink, launch, pair, gui; macos (linux and aarch64) and freebsd build; frames 77/77 against tree2, perfab-corpus2x +0.012%, 121 per-operation counts within 0.1% (largest client-key-down +0.075%), gui unit-test 1671/1675 (no failure the base has not)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/rollback.zig')
-rw-r--r--core/rollback.zig16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/rollback.zig b/core/rollback.zig
index c7d0a4e8..a55d3c87 100644
--- a/core/rollback.zig
+++ b/core/rollback.zig
@@ -404,9 +404,7 @@ pub const Copy = struct {
},
.@"struct" => |s| {
if (comptime walk.machinery(T)) return;
- // A terminal: the authority's (its emulator is never written
- // by a speculation: terminal.zig's guards).
- if (comptime @hasDecl(T, "digest") and @TypeOf(T.digest) == fn (*const T, *walk.Hasher) void) return;
+ if (comptime unwalked(T)) return;
if (s.layout == .@"packed") return;
// std's lists (a safe build's have a third field, a lock).
if (comptime walk.isList(T)) {
@@ -467,7 +465,7 @@ pub const Copy = struct {
if (comptime walk.machinery(P)) return;
const addr = @intFromPtr(ptr);
if (try c.reached(P, addr)) return;
- if (comptime @hasDecl(P, "digest") and @TypeOf(P.digest) == fn (*const P, *walk.Hasher) void) return;
+ if (comptime unwalked(P)) return;
if (c.epoch.?.owns(addr) != null) {
_ = try c.reached(void, addr);
try c.fields(P, ptr);
@@ -513,6 +511,16 @@ pub const Copy = struct {
}
};
+/// A type that hashes itself and says nothing of its fields (`replica`):
+/// a terminal, the authority's (its emulator is never written by a
+/// speculation: terminal.zig's guards), or a location row, made again and
+/// never written. One that says its fields' kinds is walked by them,
+/// whatever digest it has (the 9P state, fs.Namespace and a pane's: a
+/// replayed request writes its buffers in place).
+fn unwalked(comptime T: type) bool {
+ return @hasDecl(T, "digest") and @TypeOf(T.digest) == fn (*const T, *walk.Hasher) void and !@hasDecl(T, "replica");
+}
+
fn annotatedStruct(comptime T: type) bool {
return @typeInfo(T) == .@"struct" and @hasDecl(T, "replica");
}