diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2020-02-24 15:01:47 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-02-25 01:20:09 +0100 |
commit | c518cfa0c5ad75ddf3d743f1e35b9cf5fc2c346e (patch) | |
tree | dc1af99817725ada8e5cae4c91e49dd113d41d0b /kernel | |
parent | bpf: Use migrate_disable/enable in array macros and cgroup/lirc code. (diff) | |
download | linux-c518cfa0c5ad75ddf3d743f1e35b9cf5fc2c346e.tar.xz linux-c518cfa0c5ad75ddf3d743f1e35b9cf5fc2c346e.zip |
bpf: Provide recursion prevention helpers
The places which need to prevent the execution of trace type BPF programs
to prevent deadlocks on the hash bucket lock do this open coded.
Provide two inline functions, bpf_disable/enable_instrumentation() to
replace these open coded protection constructs.
Use migrate_disable/enable() instead of preempt_disable/enable() right away
so this works on RT enabled kernels. On a !RT kernel migrate_disable /
enable() are mapped to preempt_disable/enable().
These helpers use this_cpu_inc/dec() instead of __this_cpu_inc/dec() on an
RT enabled kernel because migrate disabled regions are preemptible and
preemption might hit in the middle of a RMW operation which can lead to
inconsistent state.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200224145644.103910133@linutronix.de
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions