diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 12:23:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 12:23:41 -0300 |
| commit | 8008a2655c0f0c9b9890fb4866f774c9b50e170c (patch) | |
| tree | ec54af73611e686751dd74dd3f4a585198a91de5 /src/trace/bpf.zig | |
| parent | 2e01933dc5c0c1903c1b7f86e453829fee9a541b (diff) | |
| download | computeranim-8008a2655c0f0c9b9890fb4866f774c9b50e170c.tar.gz computeranim-8008a2655c0f0c9b9890fb4866f774c9b50e170c.zip | |
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 <[email protected]>
Diffstat (limited to 'src/trace/bpf.zig')
| -rw-r--r-- | src/trace/bpf.zig | 5 |
1 files changed, 4 insertions, 1 deletions
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)); |
