Skip to content

Instantly share code, notes, and snippets.

@robbmanes
Created August 25, 2021 16:44
Show Gist options
  • Save robbmanes/106a87fad13d001b4835c44f1ea8658c to your computer and use it in GitHub Desktop.
Save robbmanes/106a87fad13d001b4835c44f1ea8658c to your computer and use it in GitHub Desktop.
Trace sending and receiving of SIGKILL on Linux systems
#!/usr/bin/env stap
probe begin {
printf("Watching for signal(9) and reporting sender and receiver statuses...\n");
}
probe signal.syskill {
if(sig == 9) {
printf("[%s] SEND===> PID %d (%s) sent signal %d (%s) to PID %d (%s)\n",
ctime(gettimeofday_s()),
pid(),
execname(),
sig,
sig_name,
sig_pid,
pid_name);
print_backtrace()
}
}
probe signal.handle {
if(sig == 9) {
printf("[%s] RECV<=== PID %d (%s) has received signal %d (%s)\n",
ctime(gettimeofday_s()),
pid(),
execname(),
sig,
sig_name);
print_backtrace()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment