setuids.bt(8)
π setuids.bt β the manual page, but make it make sense π
okay so bestie, you found setuids.bt(8) in the System Manager's Manual section and honestly? iconic choice. this lil baddie traces the whole setuid syscall family, and yes it uses bpftrace/eBPF. let's get into it π«Ά
β¨ NAME β¨
setuids.bt β traces the setuid family of syscalls. uses bpftrace/eBPF. periodt. π
πΈ SYNOPSIS πΈ
setuids.bt
that's it. no flags, no drama, no notes. she just runs. π
π¦ DESCRIPTION π¦
so what does she actually do? she traces privilege escalation via setuid syscalls, which lowkey makes her the main character for debugging, whitelist creation, and intrusion detection. three jobs, one script, no cap. π
the way she works is by tracing the setuid(2), setfsuid(2), and retresuid(2) syscalls using the syscall tracepoints. fr fr, that's the whole mechanism.
β οΈ okay important: since this uses BPF, only the root user can use this tool. no root, no vibes. sorry bestie π
π REQUIREMENTS π
CONFIG_BPFbpftrace
both. you need both. that's the list. β¨
π EXAMPLES π
trace setuid syscalls β like, the whole point:
# setuids.bt
slay. that's the example. π
π FIELDS π
here's the output decoder ring, bestie, learn her:
PIDβ the calling process ID.COMMβ the calling process (thread) name.UIDβ the UID of the caller.SYSCALLβ the syscall name.ARGSβ the arguments to the syscall(RET)β the return value for the syscall:0== success, other numbers indicate an error code.
π«Ά note that(RET)is the vibe check:0means we ate, anything else means something went wrong.
π OVERHEAD π
setuid calls are expected to be low frequency (<< 100/s), so the overhead of this tool is expected to be negligible. she's lightweight, she's polite, she's not gonna tank your system. πβ¨
β SOURCE β
this tool originated from the book "BPF Performance Tools", published by Addison Wesley (2019):
http://www.brendangregg.com/bpf-performance-tools-book.html
see the book for more documentation on this tool. π
this version lives in the bpftrace repository:
https://github.com/iovisor/bpftrace
also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's giving bonus content, we love her. π
π§ OS π§
Linux
π STABILITY π
Unstable β in development. she's growing, she's evolving, be nice to her. π
π AUTHOR π
Brendan Gregg
π§ SEE ALSO π§
okay and for the cute sign-off: this page comes from the USER COMMANDS manual section and it's dated 2019-07-05. vintage but still serving. π πΈ bye bestie, go trace some syscalls π¦β¨
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms