]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 13 Sep 2024 19:17:51 +0000 (21:17 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 13 Sep 2024 20:17:56 +0000 (13:17 -0700)
The assumption of 'in privileged mode reads from uninitialized stack locations
are permitted' is not quite correct since the verifier was probing for read
access rather than write access. Both tests need to be annotated as __success
for privileged and unprivileged.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240913191754.13290-6-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_int_ptr.c

index 9fc3fae5cd833b61b0807faad6c1d08169a25801..87206803c02557e9ee37f09a3b3f713f4c2c978e 100644 (file)
@@ -8,7 +8,6 @@
 SEC("socket")
 __description("ARG_PTR_TO_LONG uninitialized")
 __success
-__failure_unpriv __msg_unpriv("invalid indirect read from stack R4 off -16+0 size 8")
 __naked void arg_ptr_to_long_uninitialized(void)
 {
        asm volatile ("                                 \
@@ -36,9 +35,7 @@ __naked void arg_ptr_to_long_uninitialized(void)
 
 SEC("socket")
 __description("ARG_PTR_TO_LONG half-uninitialized")
-/* in privileged mode reads from uninitialized stack locations are permitted */
-__success __failure_unpriv
-__msg_unpriv("invalid indirect read from stack R4 off -16+4 size 8")
+__success
 __retval(0)
 __naked void ptr_to_long_half_uninitialized(void)
 {