diff options
author | Alexei Starovoitov <ast@fb.com> | 2016-03-08 08:57:13 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-08 23:28:30 +0300 |
commit | b121d1e74d1f24654bdc3165d3db1ca149501356 (patch) | |
tree | aa0326edc95e2152a2277386b5363beb7768f7dc /kernel/trace | |
parent | 8aba8b83128a04197991518e241aafd3323b705d (diff) | |
download | linux-b121d1e74d1f24654bdc3165d3db1ca149501356.tar.xz |
bpf: prevent kprobe+bpf deadlocks
if kprobe is placed within update or delete hash map helpers
that hold bucket spin lock and triggered bpf program is trying to
grab the spinlock for the same bucket on the same cpu, it will
deadlock.
Fix it by extending existing recursion prevention mechanism.
Note, map_lookup and other tracing helpers don't have this problem,
since they don't hold any locks and don't modify global data.
bpf_trace_printk has its own recursive check and ok as well.
Signed-off-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 'kernel/trace')
-rw-r--r-- | kernel/trace/bpf_trace.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 4b8caa392b86..3e4ffb3ace5f 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -13,8 +13,6 @@ #include <linux/ctype.h> #include "trace.h" -static DEFINE_PER_CPU(int, bpf_prog_active); - /** * trace_call_bpf - invoke BPF program * @prog: BPF program |