summaryrefslogtreecommitdiffstats
path: root/samples/bpf/trace_event_user.c
diff options
context:
space:
mode:
authorAndy Gospodarek <andy@greyhouse.net>2017-05-11 21:52:30 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-12 03:43:30 +0200
commitad990dbe6d3ac3af1f5f4484b1126b9fc601e98a (patch)
treedd21487768f0a759ea6c2432c58e4a459fc9e183 /samples/bpf/trace_event_user.c
parentethernet: aquantia: remove redundant checks on error status (diff)
downloadlinux-ad990dbe6d3ac3af1f5f4484b1126b9fc601e98a.tar.xz
linux-ad990dbe6d3ac3af1f5f4484b1126b9fc601e98a.zip
samples/bpf: run cleanup routines when receiving SIGTERM
Shahid Habib noticed that when xdp1 was killed from a different console the xdp program was not cleaned-up properly in the kernel and it continued to forward traffic. Most of the applications in samples/bpf cleanup properly, but only when getting SIGINT. Since kill defaults to using SIGTERM, add support to cleanup when the application receives either SIGINT or SIGTERM. Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Reported-by: Shahid Habib <shahid.habib@broadcom.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/trace_event_user.c')
-rw-r--r--samples/bpf/trace_event_user.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 0c5561d193a4..fa4336423da5 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -192,6 +192,7 @@ int main(int argc, char **argv)
setrlimit(RLIMIT_MEMLOCK, &r);
signal(SIGINT, int_exit);
+ signal(SIGTERM, int_exit);
if (load_kallsyms()) {
printf("failed to process /proc/kallsyms\n");