]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: selftests: verifier: Add nullness elision tests
authorDaniel Xu <dxu@dxuuu.xyz>
Tue, 14 Jan 2025 20:28:46 +0000 (13:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 17 Jan 2025 01:51:10 +0000 (17:51 -0800)
commitf932a8e4824b529e455b7e3eb3e5118beceb3e32
tree19ca27b2d85727299d5fa93f3a085bf3bef71b4a
parentd2102f2f5d75a84dbab6ff890359f0bd4a18ca22
bpf: selftests: verifier: Add nullness elision tests

Test that nullness elision works for common use cases. For example, we
want to check that both constant scalar spills and STACK_ZERO functions.
As well as when there's both const and non-const values of R2 leading up
to a lookup. And obviously some bound checks.

Particularly tricky are spills both smaller or larger than key size. For
smaller, we need to ensure verifier doesn't let through a potential read
into unchecked bytes. For larger, endianness comes into play, as the
native endian value tracked in the verifier may not be the bytes the
kernel would have read out of the key pointer. So check that we disallow
both.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/f1dacaa777d4516a5476162e0ea549f7c3354d73.1736886479.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_array_access.c