stapstd elf note flags
Jiri Olsa
olsajiri@gmail.com
Fri Jan 9 16:14:55 GMT 2026
hi,
I have a question about stapsdt ELF notes section. We would like to
update it with a flag, but let me describe the big picture first.
Now that we have nop5 uprobe optimization in kernel [1] we can use
it to optimize USDT probes by switching its nop1 instruction to nop5
(5 bytes nop). Both systemtap (sdt.h) and libbpf-usdt [2] (usdt.h)
headers allow to redefine macro for that.
That works well for apps running on new kernel that allows to optimize
nop5, but it will regress on old kernel, which needs to do single
stepping of the nop5 instruction when the USDT probe is hit.
To prevent that we would like to emit <nop1,nop5> instructions combo
for the USDT probe and install uprobe on top:
- nop1 if kernel does NOT have nop5 optimization support
- nop5 if kernel has nop5 optimization support
And to recognize such probes, we would like to mark USDT stapstd ELF
note with some flag saying this probe emits <nop1,nop5> instructions
combo.
We failed to squeeze/hack it in the current stapstd format. Do we need
to define new note type (like NT_STAPSDT + 1) for that, or is there
another way?
If you guys have any feedback/thoughts, that'be great to hear.
thanks,
jirka
[1] https://lore.kernel.org/bpf/20250720112133.244369-1-jolsa@kernel.org/
[2] https://github.com/libbpf/usdt
More information about the Systemtap
mailing list