bpf: check signal validity in nmi for bpf_send_signal() helper
authorYonghong Song <yhs@fb.com>
Sat, 25 May 2019 18:57:53 +0000 (11:57 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 28 May 2019 08:51:33 +0000 (10:51 +0200)
commite1afb70252a8614e1ef7aec05ff1b84fd324b782
treef8c6ffc8af4675f6e90878073ca03f59072ac420
parent0d97dacc46d9af2daba1af224747d452bd988365
bpf: check signal validity in nmi for bpf_send_signal() helper

Commit 8b401f9ed244 ("bpf: implement bpf_send_signal() helper")
introduced bpf_send_signal() helper. If the context is nmi,
the sending signal work needs to be deferred to irq_work.
If the signal is invalid, the error will appear in irq_work
and it won't be propagated to user.

This patch did an early check in the helper itself to notify
user invalid signal, as suggested by Daniel.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/trace/bpf_trace.c