Skip to contentSkip to conversation

bpf: add a verbose message if map limit is reached

PATCH Superseded Anton Protopopov 3 participants 3 messages Mar 29, 2024

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

When more than 64 maps are used by a program the verifier return -E2BIG. Add a verbose message which highlights the error and also prints the actual limit.

---
 kernel/bpf/verifier.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/bpf/verifier.c +2 -0
index 58952f040761..fa73009d05bc 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 map usage limit of %u is reached\n",
+					MAX_USED_MAPS);
 				fdput(f);
 				return -E2BIG;
 			}
Signature · 1 line
2.34.1
#2 lore raw
In reply to Anton Protopopov
Quoted 15 lines · Anton Protopopov

When more than 64 maps are used by a program the verifier return -E2BIG. Add a verbose message which highlights the error and also prints the actual limit.

---
 kernel/bpf/verifier.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/bpf/verifier.c +0 -0
index 58952f040761..fa73009d05bc 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 map usage limit of %u is reached\n",
+                                       MAX_USED_MAPS);

"map usage limit" reads as "number of times the map was used".

Please make it clear that it's the total number of maps used by a program and its subprograms.

pw-bot: cr