Skip to content

Commit

Permalink
selftests/bpf: Test gotol with large offsets
Browse files Browse the repository at this point in the history
Test gotol with offsets that don't fit into a short (i.e., larger than
32k or smaller than -32k).

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/r/20240102193531.3169422-4-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Ilya Leoshkevich authored and Alexei Starovoitov committed Jan 4, 2024
1 parent 445aea5 commit 63fac34
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tools/testing/selftests/bpf/progs/verifier_gotol.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ l3_%=: \
: __clobber_all);
}

SEC("socket")
__description("gotol, large_imm")
__success __failure_unpriv __retval(40000)
__naked void gotol_large_imm(void)
{
asm volatile (" \
gotol 1f; \
0: \
r0 = 0; \
.rept 40000; \
r0 += 1; \
.endr; \
exit; \
1: gotol 0b; \
" :
:
: __clobber_all);
}

#else

SEC("socket")
Expand Down

0 comments on commit 63fac34

Please sign in to comment.