File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
tools/testing/selftests/bpf/progs Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -670,4 +670,45 @@ __naked void ldx_w_zero_extend_check(void)
670670 : __clobber_all );
671671}
672672
673+ SEC ("socket" )
674+ __description ("s>>=31" )
675+ __success __success_unpriv __retval (0 )
676+ __naked void arsh_31 (void )
677+ {
678+ asm volatile (" \
679+ call %[bpf_get_prandom_u32]; \
680+ w2 = w0; \
681+ w2 s>>= 31; \
682+ w2 &= -134; \
683+ if w2 s> -1 goto +2; \
684+ if w2 != 0xffffff78 goto +1; \
685+ w0 /= 0; \
686+ w0 = 0; \
687+ exit; \
688+ " :
689+ : __imm (bpf_get_prandom_u32 )
690+ : __clobber_all );
691+ }
692+
693+ SEC ("socket" )
694+ __description ("s>>=63" )
695+ __success __success_unpriv __retval (0 )
696+ __naked void arsh_63 (void )
697+ {
698+ asm volatile (" \
699+ call %[bpf_get_prandom_u32]; \
700+ r2 = r0; \
701+ r2 <<= 32; \
702+ r2 s>>= 63; \
703+ r2 &= -134; \
704+ if r2 s> -1 goto +2; \
705+ if r2 != 0xffffff78 goto +1; \
706+ r0 /= 0; \
707+ r0 = 0; \
708+ exit; \
709+ " :
710+ : __imm (bpf_get_prandom_u32 )
711+ : __clobber_all );
712+ }
713+
673714char _license [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments