Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit b8e188f

Browse files
borkmannAlexei Starovoitov
authored andcommitted
selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test
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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4b3786a commit b8e188f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tools/testing/selftests/bpf/progs/verifier_int_ptr.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
SEC("socket")
99
__description("ARG_PTR_TO_LONG uninitialized")
1010
__success
11-
__failure_unpriv __msg_unpriv("invalid indirect read from stack R4 off -16+0 size 8")
1211
__naked void arg_ptr_to_long_uninitialized(void)
1312
{
1413
asm volatile (" \
@@ -36,9 +35,7 @@ __naked void arg_ptr_to_long_uninitialized(void)
3635

3736
SEC("socket")
3837
__description("ARG_PTR_TO_LONG half-uninitialized")
39-
/* in privileged mode reads from uninitialized stack locations are permitted */
40-
__success __failure_unpriv
41-
__msg_unpriv("invalid indirect read from stack R4 off -16+4 size 8")
38+
__success
4239
__retval(0)
4340
__naked void ptr_to_long_half_uninitialized(void)
4441
{

0 commit comments

Comments
 (0)