bpf: Assign ID to scalars on spill
authorMaxim Mikityanskiy <maxim@isovalent.com>
Mon, 8 Jan 2024 20:52:02 +0000 (22:52 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Jan 2024 22:40:23 +0000 (14:40 -0800)
commit8ecfc371d829bfed75e0ef2cab45b2290b982f64
tree5d245cf62f2a544b828f743091ca1fbcde6ee8b6
parent87e51ac6cb19c5d33d70d4cae9e26d2a3a5fcba0
bpf: Assign ID to scalars on spill

Currently, when a scalar bounded register is spilled to the stack, its
ID is preserved, but only if was already assigned, i.e. if this register
was MOVed before.

Assign an ID on spill if none is set, so that equal scalars could be
tracked if a register is spilled to the stack and filled into another
register.

One test is adjusted to reflect the change in register IDs.

Signed-off-by: Maxim Mikityanskiy <maxim@isovalent.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240108205209.838365-9-maxtram95@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/progs/verifier_direct_packet_access.c
tools/testing/selftests/bpf/verifier/precise.c