On Wed, Feb 3, 2021 at 3:23 PM KP Singh <kpsingh@xxxxxxxxxx> wrote: > > The BPF ringbuffer map is pre-allocated and the implementation logic > does not rely on disabling preemption or per-cpu data structures. Using > the BPF ringbuffer sleepable LSM and tracing programs does not trigger > any warnings with DEBUG_ATOMIC_SLEEP, DEBUG_PREEMPT, > PROVE_RCU and PROVE_LOCKING and LOCKDEP enabled. > > This allows helpers like bpf_copy_from_user and bpf_ima_inode_hash to > write to the BPF ring buffer from sleepable BPF programs. > > Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx> > --- Yes, I believe ringbuf is ready for sleepable BPF as is. Its commit() implementation is racing with other CPUs anyways, so it doesn't matter if reserve and commit happen on the same CPU or different ones. Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > kernel/bpf/verifier.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 5e09632efddb..4c33b4840438 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -10024,6 +10024,8 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env, > return -EINVAL; > } > break; > + case BPF_MAP_TYPE_RINGBUF: > + break; > default: > verbose(env, > "Sleepable programs can only use array and hash maps\n"); > -- > 2.30.0.365.g02bc693789-goog >