Why is recursion protection needed in bpf syscalls?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Some map operations via syscalls on hash maps (and some others)
disable bpf programs from running on the same CPU with
bpf_disable_instrumentation. The provided reason for this is to
prevent deadlocks when a nested bpf program tries to access an already
held bucket lock. From my understanding, this can happen due to a
kprobe on a function called after the lock is acquired. However,
htab_lock_bucket already handles this case by returning EBUSY if such
a scenario were to happen. Is there any other reason for disabling bpf
programs on the CPU?
The effect of this is that 1) bpf programs attached to a kprobe or
tracepoint in an irq context get skipped while inside
bpf_[enable,disable]_instrumentation block but before the
preempt_disable via htab_lock_bucket, 2) when CONFIG_PREEMPTION=y and
preempt=full then a bpf program running from user context may also get
skipped while inside the bpf_[enable,disable]_instrumentation block.

Thanks,
Usama Saqib.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux