Skip to contentSkip to conversation

bpf: add a verbose message if map limit is reached

PATCH Superseded Anton Protopopov 2 participants 3 messages Apr 1, 2024 – Apr 2, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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)

---
 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 is reached the limit of %u\n",
+					MAX_USED_MAPS);
 				fdput(f);
 				return -E2BIG;
 			}
Signature · 1 line
2.34.1
reviewer Acked-by on v2 1/1
#1 lore raw
Quoted 30 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)

---
 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 is reached the limit of %u\n",
+					MAX_USED_MAPS);
 				fdput(f);
 				return -E2BIG;
 			}
Signature · 1 line
2.34.1

LGTM thanks.

#2 lore raw
Quoted 34 lines · John Fastabend
Quoted 30 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)

---
 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 is reached the limit of %u\n",
+					MAX_USED_MAPS);
 				fdput(f);
 				return -E2BIG;
 			}
Signature · 1 line
2.34.1

LGTM thanks.

Quoted 1 line

Thanks. I will actually send yet another version, hopefully the last, with 'has reached' instead of 'is reached'