File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 2525#include "verifier_direct_stack_access_wraparound.skel.h"
2626#include "verifier_div0.skel.h"
2727#include "verifier_div_overflow.skel.h"
28+ #include "verifier_gotol.skel.h"
2829#include "verifier_helper_access_var_len.skel.h"
2930#include "verifier_helper_packet_access.skel.h"
3031#include "verifier_helper_restricted.skel.h"
@@ -131,6 +132,7 @@ void test_verifier_direct_packet_access(void) { RUN(verifier_direct_packet_acces
131132void test_verifier_direct_stack_access_wraparound (void ) { RUN (verifier_direct_stack_access_wraparound ); }
132133void test_verifier_div0 (void ) { RUN (verifier_div0 ); }
133134void test_verifier_div_overflow (void ) { RUN (verifier_div_overflow ); }
135+ void test_verifier_gotol (void ) { RUN (verifier_gotol ); }
134136void test_verifier_helper_access_var_len (void ) { RUN (verifier_helper_access_var_len ); }
135137void test_verifier_helper_packet_access (void ) { RUN (verifier_helper_packet_access ); }
136138void test_verifier_helper_restricted (void ) { RUN (verifier_helper_restricted ); }
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+
3+ #include <linux/bpf.h>
4+ #include <bpf/bpf_helpers.h>
5+ #include "bpf_misc.h"
6+
7+ #if defined(__TARGET_ARCH_x86 ) && __clang_major__ >= 18
8+
9+ SEC ("socket" )
10+ __description ("gotol, small_imm" )
11+ __success __success_unpriv __retval (1 )
12+ __naked void gotol_small_imm (void )
13+ {
14+ asm volatile (" \
15+ call %[bpf_ktime_get_ns]; \
16+ if r0 == 0 goto l0_%=; \
17+ gotol l1_%=; \
18+ l2_%=: \
19+ gotol l3_%=; \
20+ l1_%=: \
21+ r0 = 1; \
22+ gotol l2_%=; \
23+ l0_%=: \
24+ r0 = 2; \
25+ l3_%=: \
26+ exit; \
27+ " :
28+ : __imm (bpf_ktime_get_ns )
29+ : __clobber_all );
30+ }
31+
32+ #else
33+
34+ SEC ("socket" )
35+ __description ("cpuv4 is not supported by compiler or jit, use a dummy test" )
36+ __success
37+ int dummy_test (void )
38+ {
39+ return 0 ;
40+ }
41+
42+ #endif
43+
44+ char _license [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments