How to trace signals issued by the kill() syscall?
Environment
- Red Hat Enterprise Linux 7.6+
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- bcc-tools
- killsnoop
Issue
- How to trace signals issued by the
kill()syscall using eBPF/BCC script? - How to determine which application is sending signal 9/15?
Resolution
- The eBPF/BCC
killsnoopscript traces signals issued by thekill()syscall. It works by tracing the kernelsys_kill()function using dynamic tracing.
RHEL7.6+ and RHEL8:
- The bcc-tools is available from
RHEL 7.6. - Install
bcc,bcc-tools, andkernel-develpackages to use eBPFkillsnoopscript.
# yum install bcc bcc-tools kernel-devel-`uname -r` -y
RHEL9:
- Install
bccandbcc-toolspackages to use eBPFkillsnoopscript onRHEL9.
# dnf install bcc bcc-tools -y
- Example of the
killsnoopscript tracing signal 15.
Terminal:1
# /usr/share/bcc/tools/killsnoop
TIME PID COMM SIG TPID RESULT
17:43:00 2480 bash 15 9 0
17:43:00 2480 bash 15 5133 0
Terminal:2
# sleep 1000000 &
[3] 5133
# kill 9 5133
- Please refer
man 8 killsnoopfor more information.
SBR
Product(s)
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.