bpf: allow more maps in sleepable bpf programs
authorBenjamin Tissoires <bentiss@kernel.org>
Wed, 21 Feb 2024 16:25:17 +0000 (17:25 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Feb 2024 01:42:23 +0000 (17:42 -0800)
These 2 maps types are required for HID-BPF when a user wants to do
IO with a device from a sleepable tracing point.

Allowing BPF_MAP_TYPE_QUEUE (and therefore BPF_MAP_TYPE_STACK) allows
for a BPF program to prepare from an IRQ the list of HID commands to send
back to the device and then these commands can be retrieved from the
sleepable trace point.

Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Link: https://lore.kernel.org/r/20240221-hid-bpf-sleepable-v3-1-1fb378ca6301@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index 011d54a1dc5398ee437cffc3133a813df6a1676c..88e9d2e4c29f22843eb26b79a316efa4b51a2309 100644 (file)
@@ -18022,6 +18022,8 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env,
                case BPF_MAP_TYPE_SK_STORAGE:
                case BPF_MAP_TYPE_TASK_STORAGE:
                case BPF_MAP_TYPE_CGRP_STORAGE:
+               case BPF_MAP_TYPE_QUEUE:
+               case BPF_MAP_TYPE_STACK:
                        break;
                default:
                        verbose(env,