Skip to content
Commit a34a9f1a authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by Alexei Starovoitov
Browse files

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: f1a2e44a ("bpf: add queue and stack maps")
Reported-by: default avatarHsin-Wei Hung <hsinweih@uci.edu>
Tested-by: default avatarHsin-Wei Hung <hsinweih@uci.edu>
Co-developed-by: default avatarHsin-Wei Hung <hsinweih@uci.edu>
Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20230911132815.717240-1-toke@redhat.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent b772b70b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment