Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Test gotol with large offsets

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>

authored by

Ilya Leoshkevich and committed by
Alexei Starovoitov
63fac346 445aea5a

+19
+19
tools/testing/selftests/bpf/progs/verifier_gotol.c
··· 33 33 : __clobber_all); 34 34 } 35 35 36 + SEC("socket") 37 + __description("gotol, large_imm") 38 + __success __failure_unpriv __retval(40000) 39 + __naked void gotol_large_imm(void) 40 + { 41 + asm volatile (" \ 42 + gotol 1f; \ 43 + 0: \ 44 + r0 = 0; \ 45 + .rept 40000; \ 46 + r0 += 1; \ 47 + .endr; \ 48 + exit; \ 49 + 1: gotol 0b; \ 50 + " : 51 + : 52 + : __clobber_all); 53 + } 54 + 36 55 #else 37 56 38 57 SEC("socket")