bpf: Fix a verifier message for alloc size helper arg

The error message here is misleading, the argument will be rejected unless
it is a known constant.

Signed-off-by: Brendan Jackman <jackmanb@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210112123913.2016804-1-jackmanb@google.com
This commit is contained in:
Brendan Jackman 2021-01-12 12:39:13 +00:00 committed by Daniel Borkmann
parent c6458e72f6
commit 28a8add641
1 changed files with 1 additions and 1 deletions

View File

@ -4319,7 +4319,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,
err = mark_chain_precision(env, regno);
} else if (arg_type_is_alloc_size(arg_type)) {
if (!tnum_is_const(reg->var_off)) {
verbose(env, "R%d unbounded size, use 'var &= const' or 'if (var < const)'\n",
verbose(env, "R%d is not a known constant'\n",
regno);
return -EACCES;
}