diff mbox series

[RFC,bpf-next,v2,03/10] bpf/verifier: allow more maps in sleepable bpf programs

Message ID 20240214-hid-bpf-sleepable-v2-3-5756b054724d@kernel.org (mailing list archive)
State Mainlined
Commit 55bad79e33aeb670317290158a4b2ff71cdc8380
Headers show
Series allow HID-BPF to do device IOs | expand

Commit Message

Benjamin Tissoires Feb. 14, 2024, 5:18 p.m. UTC
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>

---

changes in v2:
- dropped BPF_MAP_TYPE_PROG_ARRAY from the list
---
 kernel/bpf/verifier.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alexei Starovoitov Feb. 21, 2024, 2:51 a.m. UTC | #1
On Wed, Feb 14, 2024 at 06:18:32PM +0100, Benjamin Tissoires wrote:
> 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>
> 
> ---
> 
> changes in v2:
> - dropped BPF_MAP_TYPE_PROG_ARRAY from the list
> ---
>  kernel/bpf/verifier.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 67da3f7bddb5..cb1266566b69 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -18094,6 +18094,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;

Maybe resend this one and patch 1 without RFC, so we can start landing them?
diff mbox series

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 67da3f7bddb5..cb1266566b69 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -18094,6 +18094,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,