Re: [PATCH bpf 3/3] selftests/bpf: Test gotol with large offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/2/24 11:30 AM, Ilya Leoshkevich wrote:
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@xxxxxxxxxxxxx>

It might be useful to explain why the test will fail
with unpriv mode (4K insn limit) just in case that
people are not aware of the reason.

Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>

---
  .../selftests/bpf/progs/verifier_gotol.c      | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c
index d1edbcff9a18..05a329ee45ee 100644
--- a/tools/testing/selftests/bpf/progs/verifier_gotol.c
+++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c
@@ -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")




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux