File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
tools/testing/selftests/bpf/progs Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,58 @@ static __naked void iter_limit_bug_cb(void)
274274 );
275275}
276276
277+ int tmp_var ;
278+ SEC ("socket" )
279+ __failure __msg ("infinite loop detected at insn 2" )
280+ __naked void jgt_imm64_and_may_goto (void )
281+ {
282+ asm volatile (" \
283+ r0 = %[tmp_var] ll; \
284+ l0_%=: .byte 0xe5; /* may_goto */ \
285+ .byte 0; /* regs */ \
286+ .short -3; /* off -3 */ \
287+ .long 0; /* imm */ \
288+ if r0 > 10 goto l0_%=; \
289+ r0 = 0; \
290+ exit; \
291+ " :: __imm_addr (tmp_var )
292+ : __clobber_all );
293+ }
294+
295+ SEC ("socket" )
296+ __failure __msg ("infinite loop detected at insn 1" )
297+ __naked void may_goto_self (void )
298+ {
299+ asm volatile (" \
300+ r0 = *(u32 *)(r10 - 4); \
301+ l0_%=: .byte 0xe5; /* may_goto */ \
302+ .byte 0; /* regs */ \
303+ .short -1; /* off -1 */ \
304+ .long 0; /* imm */ \
305+ if r0 > 10 goto l0_%=; \
306+ r0 = 0; \
307+ exit; \
308+ " ::: __clobber_all );
309+ }
310+
311+ SEC ("socket" )
312+ __success __retval (0 )
313+ __naked void may_goto_neg_off (void )
314+ {
315+ asm volatile (" \
316+ r0 = *(u32 *)(r10 - 4); \
317+ goto l0_%=; \
318+ goto l1_%=; \
319+ l0_%=: .byte 0xe5; /* may_goto */ \
320+ .byte 0; /* regs */ \
321+ .short -2; /* off -2 */ \
322+ .long 0; /* imm */ \
323+ if r0 > 10 goto l0_%=; \
324+ l1_%=: r0 = 0; \
325+ exit; \
326+ " ::: __clobber_all );
327+ }
328+
277329SEC ("tc" )
278330__failure
279331__flag (BPF_F_TEST_STATE_FREQ )
You can’t perform that action at this time.
0 commit comments