From c94ade9e77a811d3ff75ffc2889a65375262ab1f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 23:55:42 -0300 Subject: trace: names for PLT stubs and GOT slots; a call followed down; the vDSO is run through For a disassembly that follows a call into libc. A stub is open@plt and a slot open@got, from the relocations (libc's own, IFUNC and nameless, by the function they resolve to); telescope.got says what a slot holds and whether it is still lazy. A library function's entry is named even when its mapping was not known yet, by the alias the program imports. The chain holds through the stub's jump, the callee's first instruction, the syscall and the loader's resolver: ld.so's unwind section lacks the entry that ends it, which lost every frame there. A syscall is tied to its instruction's moment, and each frame's call is recorded with the row before it. Stepped by instruction, a call into the vDSO is one moment and its return the next: its clock loop, single-stepped, made three million moments of three reads. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- src/trace/heap_test.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/trace/heap_test.zig') diff --git a/src/trace/heap_test.zig b/src/trace/heap_test.zig index 2cb5996..aca05b0 100644 --- a/src/trace/heap_test.zig +++ b/src/trace/heap_test.zig @@ -110,14 +110,17 @@ fn check(argv: []const []const u8) !void { } try std.testing.expectEqual(@as(usize, 17), smalls); try std.testing.expect(heaps[0].fastbins.len == 0 and heaps[0].bins.len == 0); - // glibc 2.44 makes the tcache at the first free. - if (heaps[0].tcache) |t| try std.testing.expectEqual(@as(usize, 0), t.bins.len) else try std.testing.expect(l.tcache_slots); + // glibc 2.44 makes the tcache at the first free: until then the thread's pointer is on its dummy. + if (heaps[0].tcache) |t| try std.testing.expectEqual(@as(usize, 0), t.bins.len) else try std.testing.expect(l.tcache_slots and heaps[0].tcache_dummy); + try std.testing.expect(!heaps[1].tcache_dummy); // 2: the tcache's 0x30 bin full, the last freed first, each link // protected by its own address; the rest in fastbin 0x30 where there are // fastbins, else in a bin. const t = heaps[1].tcache.?; try std.testing.expectEqual(@as(usize, 1), t.bins.len); + // Where a count is the slots left, an empty bin's is the capacity. + try std.testing.expectEqual(if (l.tcache_slots) @as(?u16, @intCast(fill)) else null, t.capacity); const bin = t.bins[0]; try std.testing.expectEqual(heap.Where{ .tcache = 1 }, bin.in); try std.testing.expectEqual(fill, bin.entries.len); -- cgit v1.3