Skip to content

Commit

Permalink
selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
  • Loading branch information
borkmann authored and intel-lab-lkp committed Sep 13, 2024
1 parent 2bc518a commit fa70bfb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tools/testing/selftests/bpf/progs/verifier_int_ptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 (" \
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit fa70bfb

Please sign in to comment.