diff options
author | KP Singh <kpsingh@kernel.org> | 2021-02-04 19:36:21 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-02-04 16:35:00 -0800 |
commit | ba90c2cc0231124d6de63576e8bdf371e92c8fd3 (patch) | |
tree | d73401b0c9eb95ec9c8d8a9fccdaedaed62e6496 /kernel/bpf/verifier.c | |
parent | ec45c5faa2f4b3d53d6c04a334eb51d37d90cb56 (diff) | |
download | lwn-ba90c2cc0231124d6de63576e8bdf371e92c8fd3.tar.gz lwn-ba90c2cc0231124d6de63576e8bdf371e92c8fd3.zip |
bpf: Allow usage of BPF ringbuffer in sleepable programs
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@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210204193622.3367275-2-kpsingh@kernel.org
Diffstat (limited to 'kernel/bpf/verifier.c')
-rw-r--r-- | kernel/bpf/verifier.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 5e09632efddb..9749081bd26d 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -10024,9 +10024,11 @@ 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"); + "Sleepable programs can only use array, hash, and ringbuf maps\n"); return -EINVAL; } |