]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf: Let the verifier assign ids on stack fills
authorPuranjay Mohan <puranjay@kernel.org>
Tue, 3 Feb 2026 16:50:57 +0000 (08:50 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 3 Feb 2026 18:31:40 +0000 (10:31 -0800)
commit3cd5c890652ba1f0682adc291b5446245259b692
treea78bb05804f6785a768ffefae7b772dddd85bf91
parentd95d76aa772bf94df353b015b1cb38303d4a415d
bpf: Let the verifier assign ids on stack fills

The next commit will allow clearing of scalar ids if no other
register/stack slot has that id. This is because if only one register
has a unique id, it can't participate in bounds propagation and is
equivalent to having no id.

But if the id of a stack slot is cleared by clear_singular_ids() in the
next commit, reading that stack slot into a register will not establish
a link because the stack slot's id is cleared.

This can happen in a situation where a register is spilled and later
loses its id due to a multiply operation (for example) and then the
stack slot's id becomes singular and can be cleared.

Make sure that scalar stack slots have an id before we read them into a
register.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://lore.kernel.org/r/20260203165102.2302462-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c