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:
parent
c6458e72f6
commit
28a8add641
|
@ -4319,7 +4319,7 @@ skip_type_check:
|
||||||
err = mark_chain_precision(env, regno);
|
err = mark_chain_precision(env, regno);
|
||||||
} else if (arg_type_is_alloc_size(arg_type)) {
|
} else if (arg_type_is_alloc_size(arg_type)) {
|
||||||
if (!tnum_is_const(reg->var_off)) {
|
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);
|
regno);
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue