From: Andrii Nakryiko Date: Sat, 2 Dec 2023 17:57:02 +0000 (-0800) Subject: bpf: enforce precision of R0 on program/async callback return X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=eabe518de533a4291996020977054a7a7b78c7d3;p=linux.git bpf: enforce precision of R0 on program/async callback return Given we enforce a valid range for program and async callback return value, we must mark R0 as precise to avoid incorrect state pruning. Fixes: b5dc0163d8fd ("bpf: precise scalar_value tracking") Acked-by: Eduard Zingerman Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20231202175705.885270-9-andrii@kernel.org Signed-off-by: Alexei Starovoitov --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index c54944af1bccb..2cd150d6d141e 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -15138,6 +15138,10 @@ enforce_retval: return -EINVAL; } + err = mark_chain_precision(env, regno); + if (err) + return err; + if (!retval_range_within(range, reg)) { verbose_invalid_scalar(env, reg, range, exit_ctx, reg_name); if (!is_subprog &&