Skip to content

Commit 98a89c3

Browse files
aspskKernel Patches Daemon
authored andcommitted
bpf: add a verbose message when the BTF limit is reached
When a BPF program which is being loaded reaches the map limit (MAX_USED_MAPS) or the BTF limit (MAX_USED_BTFS) the -E2BIG is returned. However, in the former case there is an accompanying verifier verbose message, and in the latter case there is not. Add a verbose message to make the behaviour symmetrical. Signed-off-by: Anton Protopopov <[email protected]>
1 parent 715d6cb commit 98a89c3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/bpf/verifier.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20193,8 +20193,11 @@ static int __add_used_btf(struct bpf_verifier_env *env, struct btf *btf)
2019320193
if (env->used_btfs[i].btf == btf)
2019420194
return i;
2019520195

20196-
if (env->used_btf_cnt >= MAX_USED_BTFS)
20196+
if (env->used_btf_cnt >= MAX_USED_BTFS) {
20197+
verbose(env, "The total number of btfs per program has reached the limit of %u\n",
20198+
MAX_USED_BTFS);
2019720199
return -E2BIG;
20200+
}
2019820201

2019920202
btf_get(btf);
2020020203

0 commit comments

Comments
 (0)