LWN: Comments on "Comparing SystemTap and bpftrace" https://lwn.net/Articles/852112/ This is a special feed containing comments posted to the individual LWN article titled "Comparing SystemTap and bpftrace". en-us Mon, 29 Sep 2025 07:40:23 +0000 Mon, 29 Sep 2025 07:40:23 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Comparing SystemTap and bpftrace https://lwn.net/Articles/853518/ https://lwn.net/Articles/853518/ ema <div class="FormattedComment"> Thank you for your kind words Sanjeev. Without the suggestions and the editing work from the LWN folks it would not have been half as clear, believe me. :)<br> </div> Tue, 20 Apr 2021 07:35:01 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/853506/ https://lwn.net/Articles/853506/ ringerc <div class="FormattedComment"> I split the details into a child comment so the main one wouldn&#x27;t be too long.<br> <p> SystemTap is widely available even for older systems, though the packaged versions are usually older so it&#x27;s a bit of a pain to write scripts that work with them. It&#x27;s easy to compile if you&#x27;re allowed to install the needed toolchain and dependencies on the target and you have the time, but that adds to the hassle. Especially when you&#x27;re not hands-on and you just want the other end (customer, or whatever) to run a tapscript for you.<br> <p> Additionally, for its most fully featured and default runtime (kmod) SystemTap requires kernel headers and preferably debuginfo. These are frequently unavailable for whatever older kernel point release happens to be running on the target system at the time you need to run some tracing tools. Or at best you have to go digging manually through some archive of old packages that have aged out of the main repositories for the OS. The stap-prep tool can&#x27;t usually find them for you. So to reliably use systemtap&#x27;s kmod runtime you need to plan ahead and install kernel headers and debuginfo whenever you update the kernel, which nobody ever does. This drastically limits its practical utility.<br> <p> But lots of eBPF features and helper functions are only available in much newer kernels. On widely deployed &quot;enterprise&quot; system kernels it&#x27;s basically useless for nontrivial userspace tracing and analysis. eBPF is quite fragile in the face of kernel version changes as soon as you step outside the canned tracepoints, and the set of helper functions is extremely limited.<br> <p> Even if you can run your bpf scripts, your userspace stacks are going to look like &quot;-&quot; most of the time, because everything is compiled with -fomit-frame-pointer. AFAICS most bpf tools don&#x27;t handle external DWARF debuginfo or use tools like libunwind to help them out. So you land up having to recompile with -fno-omit-frame-pointer and use unstripped binaries with debuginfo in the main binary. This basically means you can&#x27;t do much tracing of packaged userspace binaries as are the norm on production systems.<br> <p> SystemTap on the other hand will not only get you your userspace stacks using DWARF detached debuginfo, it&#x27;ll now even talk to a debuginfod to download symbols for you during probe compilation. It&#x27;ll walk userspace pointers chains, examine struct members, recursively print structs, handle unions and so much more using simple built-in syntax. So it&#x27;s currently infinitely more powerful for userspace probing and analysis ...<br> <p> ... or it would be if only you could find and install the kernel headers.<br> <p> SystemTap also has &#x27;dyninst&#x27; and &#x27;bpf&#x27; runtimes, which entirely avoid the need for kernel headers and can often be used without kernel debuginfo. But a considerable number of the built-in systemtap &quot;tapsets&quot; rely on embedded-C code written for kernelspace, which simply won&#x27;t work for a dyninst or bpf tapscript. Or they rely on helper functions exported by the kmod runtime that are not implemented for the dyninst or bpf runtimes. So in practice most of your existing systemtap scripts won&#x27;t work, and scripts are more difficult to write for the dyninst or bpf runtimes.<br> <p> Additionally, the dyninst runtime requires that you wrap the target using LD_PRELOAD. So it&#x27;s cool for development and QA work but for a production system it&#x27;s often impractical, as you frequently want to non-intrusively trace an already-server running process.<br> <p> This means you can&#x27;t usually apply eBPF or use SystemTap with any of its runtimes to any system you encounter in the wild.<br> </div> Tue, 20 Apr 2021 01:22:24 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/853503/ https://lwn.net/Articles/853503/ ringerc <div class="FormattedComment"> Some key operational distinctions exist too, especially for userspace tracing, which is where my interests lie.<br> <p> The TL;DR is that in practice the effective, reliable use of any of these tools tends to require that you be able to plan ahead in order to install necessary debuginfo, kernel headers, utilities etc well ahead of time, before they age out of repositories. For best results you&#x27;ll want a much newer kernel than the enterprise-y distro defaults too. So they work best in tightly controlled farms of machines where the people who care about tracing can control how the systems are installed and updated.<br> <p> * SystemTap kmod mode needs kernel headers and prefers kernel debuginfo. Both age out of repos quickly.<br> * SystemTap dyninst runtime requires restarting the target so it can LD_PRELOAD, and is more limited than kmod runtime<br> * Effective eBPF userspace tracing in practice requires quite new kernels, so bpftrace, bcc, etc are hard or impractical to apply to older kernels common in the wild<br> * SystemTap bpf runtime is limited by the same kernel version concerns as bcc etc *and* its own systemtap-specific limitations.<br> * SystemTap doesn&#x27;t usually work on kernels newer than the systemtap release due to internal kernel API changes. It spews compile errors. So you usually need to get a newer systemtap to work with newer kernels.<br> * bpftrace and bcc don&#x27;t currently handle detached DWARF debuginfo, and don&#x27;t even handle binaries built with the x64 default -fomit-frame-pointer compile flag properly.<br> * The rich debuginfo based access to userspace state available in systemtap is mostly absent from bpf tooling targeting userspace, so access to your program state is very painful with bpf. <br> <p> So on older kernels you can use systemtap, except you probably can&#x27;t get the kernels headers and debuginfo installed. And you&#x27;re generally not going to encounter newer bpf-friendly kernels in the wild on production systems unless you&#x27;re managing your own clusters of systems. If you do have a newer kernel and want to use bpf, you get to fight with its lack of DWARF based unwinding and its primitive to nonexistent ability to understand userspace memory contents.<br> <p> I find this intensely frustrating, as I get a great deal of value out of both tools in my own debugging and performance work. But systemtap sometimes breaks when I update my kernel on my laptop, and I need a bleeding-edge bcc for even some of the basic functionality I needed for simple userspace tracers.<br> </div> Tue, 20 Apr 2021 01:21:52 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/853115/ https://lwn.net/Articles/853115/ ghane <div class="FormattedComment"> Emanuele,<br> <p> I do not use either debugging tool, or debug compiled code, but this article was a pleasure to read for its clarity.<br> <p> It provides an excellent overview of the *different use cases* where one might use these tools. There are too few of these articles, I think. <br> <p> Thank you<br> -- <br> Sanjeev<br> </div> Sat, 17 Apr 2021 04:08:24 +0000 dwarf stacktrace in bpf https://lwn.net/Articles/852593/ https://lwn.net/Articles/852593/ mathstuf <div class="FormattedComment"> This article[1] is the latest I can find. You can have bounded loops now, but they must be verifiable. Validating that there is an end to the stack is data-dependent and likely not allowed. One could get up to a fixed stack size though I presume.<br> <p> [1]<a href="https://lwn.net/Articles/794934/">https://lwn.net/Articles/794934/</a><br> </div> Wed, 14 Apr 2021 14:14:55 +0000 dwarf stacktrace in bpf https://lwn.net/Articles/852592/ https://lwn.net/Articles/852592/ fuhchee <div class="FormattedComment"> <font class="QuotedText">&gt; Loops are allowed</font><br> <p> Last I heard, this was compile-time bounded, implemented by unrolling.<br> </div> Wed, 14 Apr 2021 13:27:19 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/852584/ https://lwn.net/Articles/852584/ rahulsundaram <div class="FormattedComment"> This is good to see, LWN should always link to the bug reports authors file in the relevant articles. For those interested in the issues, having a place to followup is important. <br> </div> Wed, 14 Apr 2021 11:03:51 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/852580/ https://lwn.net/Articles/852580/ hazmat <div class="FormattedComment"> thanks to the author for posting bpftrace issues noted in the article to the upstream<br> <a href="https://github.com/iovisor/bpftrace/issues/created_by/ema">https://github.com/iovisor/bpftrace/issues/created_by/ema</a><br> <p> </div> Wed, 14 Apr 2021 10:07:09 +0000 dwarf stacktrace in bpf https://lwn.net/Articles/852575/ https://lwn.net/Articles/852575/ seanyoung <div class="FormattedComment"> BPF is pretty powerful nowadays. Loops are allowed; instruction set is complete (you can work around the missing signed div) and instruction limits are high. I don&#x27;t understand why dwarf stacktraces can&#x27;t be generated in BPF.<br> </div> Wed, 14 Apr 2021 09:02:15 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/852558/ https://lwn.net/Articles/852558/ fuhchee <div class="FormattedComment"> Thank you for this fair &amp; balanced comparison!<br> </div> Tue, 13 Apr 2021 23:50:08 +0000 Comparing SystemTap and bpftrace https://lwn.net/Articles/852546/ https://lwn.net/Articles/852546/ atnot <div class="FormattedComment"> One note for anyone trying out bpftrace, that unfortunately makes the out-of-the-box experience a little bit more difficult than described here, is that it will fail with an permission denied error when kernel lockdown is enabled, as more distributions are doing automatically. In that case, lockdown must be disabled using a sysrq shortcut, /proc/sysrq-trigger, or a reboot with different lockdown kernel parameter.<br> <p> I hope in the future some solution can be found to not have to compromise between security and debuggability in production systems in this way, but with the deep reach that kprobes have into the kernel it seems somewhat unlikely.<br> </div> Tue, 13 Apr 2021 20:46:17 +0000