tools/killsnoop: migrate to tracepoints - #5546
Merged
Merged
Conversation
Fixes iovisor#3592 This commit updates the python killsnoop tool to use tracepoints for the kill, tkill, and tgkill syscalls. Previously, it used kprobes on sys_kill, which broke on Linux 5.11 due to kernel changes. This brings the python tool in parity with the libbpf-tools C version (sigsnoop), providing a more robust and stable tracing mechanism.
codebyangelo
requested review from
brendangregg,
chenhengqi,
ekyooo and
yonghong-song
as code owners
August 21, 2026 09:22
ekyooo
reviewed
Aug 27, 2026
| }; | ||
| } | ||
|
|
||
| TRACEPOINT_PROBE(syscalls, sys_enter_kill) |
Collaborator
There was a problem hiding this comment.
TRACEPOINT_PROBE-based BPF programs require Linux 4.7 or later. Please update the test_killsnoop() kernel gate from 4.4 to 4.7, consistent with the existing tracepoint tests.
for example,
--- a/tests/python/test_tools_smoke.py
+++ b/tests/python/test_tools_smoke.py
@@
- @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
+ @skipUnless(kernel_version_ge(4,7), "requires kernel >= 4.7")
| { | ||
| return probe_exit(args, args->ret); | ||
| } | ||
| ; |
Collaborator
There was a problem hiding this comment.
Please remove the extra blank lines and semicolon.
Contributor
Author
There was a problem hiding this comment.
Thank you for the guidance. Done.
Removed unnecessary semicolon and whitespace in killsnoop.py.
ekyooo
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3592
This commit updates the python killsnoop tool to use tracepoints for the kill, tkill, and tgkill syscalls. Previously, it used kprobes on sys_kill, which broke on Linux 5.11 due to kernel changes. This brings the python tool in parity with the libbpf-tools C version (sigsnoop), providing a more robust and stable tracing mechanism.
Description
tracepoints.architectural changes to syscall wrappers caused this kprobe approach to fail. This PR
removes the fragile kprobe logic and replaces it with robust
TRACEPOINT_PROBEmacros forsyscalls:sys_enter_kill,tkill, andtgkill(and their respectivesys_exitcounterparts).
Why this approach
to the underlying function renaming and
pt_regsmapping changes that break kprobes.migrated to this exact tracepoint approach, but the original Python tool was left behind.
This PR brings the Python implementation back into parity and restores its functionality on
all modern kernels.
Checklist
tools/toolname:,libbpf-tools/toolname:,src/cc:,docs:,build:,tests/python:)For new tools only
man/man8/) with an OVERHEAD section*_example.txt)tests/python/test_tools_smoke.py