File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 85
85
#include "verifier_store_release.skel.h"
86
86
#include "verifier_subprog_precision.skel.h"
87
87
#include "verifier_subreg.skel.h"
88
+ #include "verifier_tailcall.skel.h"
88
89
#include "verifier_tailcall_jit.skel.h"
89
90
#include "verifier_typedef.skel.h"
90
91
#include "verifier_uninit.skel.h"
@@ -219,6 +220,7 @@ void test_verifier_stack_ptr(void) { RUN(verifier_stack_ptr); }
219
220
void test_verifier_store_release (void ) { RUN (verifier_store_release ); }
220
221
void test_verifier_subprog_precision (void ) { RUN (verifier_subprog_precision ); }
221
222
void test_verifier_subreg (void ) { RUN (verifier_subreg ); }
223
+ void test_verifier_tailcall (void ) { RUN (verifier_tailcall ); }
222
224
void test_verifier_tailcall_jit (void ) { RUN (verifier_tailcall_jit ); }
223
225
void test_verifier_typedef (void ) { RUN (verifier_typedef ); }
224
226
void test_verifier_uninit (void ) { RUN (verifier_uninit ); }
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
+ struct {
8
+ __uint (type , BPF_MAP_TYPE_ARRAY );
9
+ __uint (max_entries , 1 );
10
+ __type (key , __u32 );
11
+ __type (value , __u32 );
12
+ } map_array SEC (".maps" );
13
+
14
+ SEC ("socket" )
15
+ __description ("invalid map type for tail call" )
16
+ __failure __msg ("expected prog array map for tail call" )
17
+ __failure_unpriv
18
+ __naked void invalid_map_for_tail_call (void )
19
+ {
20
+ asm volatile (" \
21
+ r2 = %[map_array] ll; \
22
+ r3 = 0; \
23
+ call %[bpf_tail_call]; \
24
+ exit; \
25
+ " :
26
+ : __imm (bpf_tail_call ),
27
+ __imm_addr (map_array )
28
+ : __clobber_all );
29
+ }
30
+
31
+ char _license [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments