]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - kernel/bpf/verifier.c
bpf: Track spill/fill of bounded scalars.
authorYonghong Song <yhs@fb.com>
Fri, 9 Oct 2020 01:12:38 +0000 (18:12 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 9 Oct 2020 20:03:06 +0000 (22:03 +0200)
commit5689d49b71ad25409e41c6052dd9549fbeaf9bde
treee1d97dec229a6d4f921069149e4a008aa15366f3
parent75748837b7e56919679e02163f45d5818c644d03
bpf: Track spill/fill of bounded scalars.

Under register pressure the llvm may spill registers with bounds into the stack.
The verifier has to track them through spill/fill otherwise many kinds of bound
errors will be seen. The spill/fill of induction variables was already
happening. This patch extends this logic from tracking spill/fill of a constant
into any bounded register. There is no need to track spill/fill of unbounded,
since no new information will be retrieved from the stack during register fill.

Though extra stack difference could cause state pruning to be less effective, no
adverse affects were seen from this patch on selftests and on cilium programs.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20201009011240.48506-3-alexei.starovoitov@gmail.com
kernel/bpf/verifier.c