From 8008a2655c0f0c9b9890fb4866f774c9b50e170c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:23:33 -0300 Subject: kernel: on today's main Symbols come from Symbols (perf.lookup is gone), string ids from event.stringId, and ptrace.Process is used as it is now. A USDT semaphore of the program itself is raised by the tracer: the kernel's counter landed on the wrong word of a small lld-linked target, whose page of the file is mapped writable twice. test-kernel also runs the library tests of perf, usdt and bpf. Co-Authored-By: Claude Fable 5.2 --- src/trace/bpf.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/trace/bpf.zig') diff --git a/src/trace/bpf.zig b/src/trace/bpf.zig index 5dad4c6..a550419 100644 --- a/src/trace/bpf.zig +++ b/src/trace/bpf.zig @@ -482,7 +482,10 @@ pub const Tracer = struct { } /// A static probe of the file `path` (`p` from `usdt.probes` with no - /// bias). The kernel raises its semaphore while we are attached. + /// bias). The kernel raises its semaphore in every process that maps + /// the file, while we are attached; where the same page of the file is + /// mapped writable twice it raises the wrong word, so for a target at + /// hand write the semaphore yourself and pass the probe without one. pub fn usdtProbe(t: *Tracer, elf: usdt.Elf, path: [*:0]const u8, p: usdt.Probe, id: u64) !void { const semaphore = if (p.semaphore == 0) 0 else elf.offset(p.semaphore) orelse return error.NoSuchProbe; try t.attach("uprobe", path, elf.offset(p.pc) orelse return error.NoSuchProbe, semaphore, try usdtProgram(t.maps, @intCast(t.pid), id, p.args)); -- cgit v1.3