Skip to contentSkip to conversation

bpf: add a verbose message if map limit is reached

PATCH Applied Anton Protopopov 3 participants 3 messages Apr 2, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 bpf: add a verbose message if map limit is reached

When more than 64 maps are used by a program and its subprograms the verifier returns -E2BIG. Add a verbose message which highlights the source of the error and also print the actual limit.

v1 -> v2:
* make the message more clear (Alexey)
v2 -> v3:
* fixed grammar (Anton)

---
 kernel/bpf/verifier.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/bpf/verifier.c +2 -0
index edb650667f44..559526191ae7 100644
@@ -18348,6 +18348,8 @@ static int resolve_pseudo_ldimm64(struct bpf_verifier_env *env)
 			}
 
 			if (env->used_map_cnt >= MAX_USED_MAPS) {
+				verbose(env, "The total number of maps per program has reached the limit of %u\n",
+					MAX_USED_MAPS);
 				fdput(f);
 				return -E2BIG;
 			}
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 21 lines · Anton Protopopov

When more than 64 maps are used by a program and its subprograms the verifier returns -E2BIG. Add a verbose message which highlights the source of the error and also print the actual limit.

v1 -> v2:
* make the message more clear (Alexey)
v2 -> v3:
* fixed grammar (Anton)

---
  kernel/bpf/verifier.c | 2 ++
  1 file changed, 2 insertions(+)
kernel/bpf/verifier.c +0 -0
index edb650667f44..559526191ae7 100644

kernel/bpf/verifier.c static int resolve_pseudo_ldimm64(struct bpf_verifier_env *env) · line 18352

Quoted 5 lines
kernel/bpf/verifier.c +2 -0
@@ -18348,6 +18348,8 @@ static int resolve_pseudo_ldimm64(struct bpf_verifier_env *env)
  			}
 
  			if (env->used_map_cnt >= MAX_USED_MAPS) {
+				verbose(env, "The total number of maps per program has reached the limit of %u\n",
+					MAX_USED_MAPS);

Btw, small nit, but might make sense to streamline capitalization across verbose() messages. Bit of a mix of small and capital letters right now in the verifier code. Either way, independent of this one.

Cheers,
Daniel

#2 lore raw
In reply to Anton Protopopov
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 10 lines · On Tue, 2 Apr 2024 07:33:47 +0000 you wrote:

When more than 64 maps are used by a program and its subprograms the verifier returns -E2BIG. Add a verbose message which highlights the source of the error and also print the actual limit.

v1 -> v2:
* make the message more clear (Alexey)
v2 -> v3:
* fixed grammar (Anton)

[...]

Here is the summary with links:
- [v3,bpf-next] bpf: add a verbose message if map limit is reached

    https://git.kernel.org/bpf/bpf-next/c/9dc182c58b5f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html