diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2023-09-11 15:28:14 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-09-12 04:04:49 +0200 |
commit | a34a9f1a19afe9c60ca0ea61dfeee63a1c2baac8 (patch) | |
tree | d010dd5bfc01bd179f3dd1b0499680af02168902 /tools | |
parent | selftests/bpf: Update bpf_clone_redirect expected return code (diff) | |
download | linux-a34a9f1a19afe9c60ca0ea61dfeee63a1c2baac8.tar.xz linux-a34a9f1a19afe9c60ca0ea61dfeee63a1c2baac8.zip |
bpf: Avoid deadlock when using queue and stack maps from NMI
Sysbot discovered that the queue and stack maps can deadlock if they are
being used from a BPF program that can be called from NMI context (such as
one that is attached to a perf HW counter event). To fix this, add an
in_nmi() check and use raw_spin_trylock() in NMI context, erroring out if
grabbing the lock fails.
Fixes: f1a2e44a3aec ("bpf: add queue and stack maps")
Reported-by: Hsin-Wei Hung <hsinweih@uci.edu>
Tested-by: Hsin-Wei Hung <hsinweih@uci.edu>
Co-developed-by: Hsin-Wei Hung <hsinweih@uci.edu>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20230911132815.717240-1-toke@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions