summaryrefslogtreecommitdiff
path: root/kernel/bpf/hashtab.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-02-24 15:01:49 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-02-24 16:20:10 -0800
commitb6e5dae15a61b0cc9219799926813baad0b58967 (patch)
tree54d5a5804fe457956725474e079ec989054cba3c /kernel/bpf/hashtab.c
parent085fee1a72a9fba101a4a68a2c02fa8bd2b6f913 (diff)
bpf: Replace open coded recursion prevention in sys_bpf()
The required protection is that the caller cannot be migrated to a different CPU as these functions end up in places which take either a hash bucket lock or might trigger a kprobe inside the memory allocator. Both scenarios can lead to deadlocks. The deadlock prevention is per CPU by incrementing a per CPU variable which temporarily blocks the invocation of BPF programs from perf and kprobes. Replace the open coded preempt_[dis|en]able and __this_cpu_[inc|dec] pairs with the new helper functions. These functions are already prepared to make BPF work on PREEMPT_RT enabled kernels. No functional change for !RT kernels. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200224145644.317843926@linutronix.de
Diffstat (limited to 'kernel/bpf/hashtab.c')
0 files changed, 0 insertions, 0 deletions