File tree Expand file tree Collapse file tree 6 files changed +74
-2
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 6 files changed +74
-2
lines changed Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ LINKED_SKELS := test_static_linked.skel.h linked_funcs.skel.h \
330330
331331LSKELS := kfunc_call_test.c fentry_test.c fexit_test.c fexit_sleep.c \
332332 test_ringbuf.c atomics.c trace_printk.c trace_vprintk.c \
333- map_ptr_kern.c core_kern.c
333+ map_ptr_kern.c core_kern.c core_kern_overflow.c
334334# Generate both light skeleton and libbpf skeleton for these
335335LSKELS_EXTRA := test_ksyms_module.c test_ksyms_weak.c kfunc_call_test_subprog.c
336336SKEL_BLACKLIST += $$(LSKELS )
Original file line number Diff line number Diff line change 1313#define CREATE_TRACE_POINTS
1414#include "bpf_testmod-events.h"
1515
16+ typedef int (* func_proto_typedef )(long );
17+ typedef int (* func_proto_typedef_nested1 )(func_proto_typedef );
18+ typedef int (* func_proto_typedef_nested2 )(func_proto_typedef_nested1 );
19+
1620DEFINE_PER_CPU (int , bpf_testmod_ksym_percpu ) = 123 ;
1721
1822noinline void
@@ -31,6 +35,9 @@ struct bpf_testmod_btf_type_tag_2 {
3135
3236noinline int
3337bpf_testmod_test_btf_type_tag_user_1 (struct bpf_testmod_btf_type_tag_1 __user * arg ) {
38+ BTF_TYPE_EMIT (func_proto_typedef );
39+ BTF_TYPE_EMIT (func_proto_typedef_nested1 );
40+ BTF_TYPE_EMIT (func_proto_typedef_nested2 );
3441 return arg -> a ;
3542}
3643
Original file line number Diff line number Diff line change 77void test_core_kern_lskel (void )
88{
99 struct core_kern_lskel * skel ;
10+ int link_fd ;
1011
1112 skel = core_kern_lskel__open_and_load ();
12- ASSERT_OK_PTR (skel , "open_and_load" );
13+ if (!ASSERT_OK_PTR (skel , "open_and_load" ))
14+ return ;
15+
16+ link_fd = core_kern_lskel__core_relo_proto__attach (skel );
17+ if (!ASSERT_GT (link_fd , 0 , "attach(core_relo_proto)" ))
18+ goto cleanup ;
19+
20+ /* trigger tracepoints */
21+ usleep (1 );
22+ ASSERT_TRUE (skel -> bss -> proto_out [0 ], "bpf_core_type_exists" );
23+ ASSERT_FALSE (skel -> bss -> proto_out [1 ], "!bpf_core_type_exists" );
24+ ASSERT_TRUE (skel -> bss -> proto_out [2 ], "bpf_core_type_exists. nested" );
25+
26+ cleanup :
1327 core_kern_lskel__destroy (skel );
1428}
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+
3+ #include "test_progs.h"
4+ #include "core_kern_overflow.lskel.h"
5+
6+ void test_core_kern_overflow_lskel (void )
7+ {
8+ struct core_kern_overflow_lskel * skel ;
9+
10+ skel = core_kern_overflow_lskel__open_and_load ();
11+ if (!ASSERT_NULL (skel , "open_and_load" ))
12+ core_kern_overflow_lskel__destroy (skel );
13+ }
Original file line number Diff line number Diff line change @@ -101,4 +101,20 @@ int balancer_ingress(struct __sk_buff *ctx)
101101 return 0 ;
102102}
103103
104+ typedef int (* func_proto_typedef___match )(long );
105+ typedef int (* func_proto_typedef___doesnt_match )(char * );
106+ typedef int (* func_proto_typedef_nested1 )(func_proto_typedef___match );
107+
108+ int proto_out [3 ];
109+
110+ SEC ("raw_tracepoint/sys_enter" )
111+ int core_relo_proto (void * ctx )
112+ {
113+ proto_out [0 ] = bpf_core_type_exists (func_proto_typedef___match );
114+ proto_out [1 ] = bpf_core_type_exists (func_proto_typedef___doesnt_match );
115+ proto_out [2 ] = bpf_core_type_exists (func_proto_typedef_nested1 );
116+
117+ return 0 ;
118+ }
119+
104120char LICENSE [] SEC ("license" ) = "GPL" ;
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ #include "vmlinux.h"
3+
4+ #include <bpf/bpf_helpers.h>
5+ #include <bpf/bpf_tracing.h>
6+ #include <bpf/bpf_core_read.h>
7+
8+ typedef int (* func_proto_typedef )(long );
9+ typedef int (* func_proto_typedef_nested1 )(func_proto_typedef );
10+ typedef int (* func_proto_typedef_nested2 )(func_proto_typedef_nested1 );
11+
12+ int proto_out ;
13+
14+ SEC ("raw_tracepoint/sys_enter" )
15+ int core_relo_proto (void * ctx )
16+ {
17+ proto_out = bpf_core_type_exists (func_proto_typedef_nested2 );
18+
19+ return 0 ;
20+ }
21+
22+ char LICENSE [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments