linux/include
Song Liu bc235cdb42 bpf: Prevent deadlock from recursive bpf_task_storage_[get|delete]
BPF helpers bpf_task_storage_[get|delete] could hold two locks:
bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Calling
these helpers from fentry/fexit programs on functions in bpf_*_storage.c
may cause deadlock on either locks.

Prevent such deadlock with a per cpu counter, bpf_task_storage_busy. We
need this counter to be global, because the two locks here belong to two
different objects: bpf_local_storage_map and bpf_local_storage. If we
pick one of them as the owner of the counter, it is still possible to
trigger deadlock on the other lock. For example, if bpf_local_storage_map
owns the counters, it cannot prevent deadlock on bpf_local_storage->lock
when two maps are used.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210225234319.336131-3-songliubraving@fb.com
2021-02-26 11:51:48 -08:00
..
acpi Merge branch 'acpi-messages' 2021-02-15 17:04:53 +01:00
asm-generic Scheduler updates for v5.12: 2021-02-21 12:35:04 -08:00
clocksource
crypto
drm drm/dp/mst: Export drm_dp_get_vc_payload_bw() 2021-02-02 17:31:37 +02:00
dt-bindings USB/Thunderbolt patches for 5.12-rc1 2021-02-20 21:32:37 -08:00
keys
kunit
kvm
linux bpf: Prevent deadlock from recursive bpf_task_storage_[get|delete] 2021-02-26 11:51:48 -08:00
math-emu
media
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next 2021-02-17 13:19:24 -08:00
pcmcia
ras
rdma
scsi
soc ARM: SoC drivers for v5.12 2021-02-20 18:42:28 -08:00
sound ALSA: pcm: One more dependency for hw constraints 2021-01-23 16:59:24 +01:00
target
trace These are the latest RCU updates for v5.12: 2021-02-21 12:04:41 -08:00
uapi The performance event updates for v5.12 are: 2021-02-21 12:49:32 -08:00
vdso
video
xen Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2021-02-20 17:45:32 -08:00