bpf: preserve constant zero when doing partial register restore
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 5 Dec 2023 18:42:44 +0000 (10:42 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 5 Dec 2023 21:40:21 +0000 (13:40 -0800)
commite322f0bcb8d371f4606eaf141c7f967e1a79bcb7
tree465b4dead3816fce4a5b27dafd7f566fb5b75da4
parentb33ceb6a3d2ee07fdd836373383a6d4783581324
bpf: preserve constant zero when doing partial register restore

Similar to special handling of STACK_ZERO, when reading 1/2/4 bytes from
stack from slot that has register spilled into it and that register has
a constant value zero, preserve that zero and mark spilled register as
precise for that. This makes spilled const zero register and STACK_ZERO
cases equivalent in their behavior.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231205184248.1502704-7-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c