File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 1818#include "test_global_func15.skel.h"
1919#include "test_global_func16.skel.h"
2020#include "test_global_func17.skel.h"
21+ #include "test_global_func18.skel.h"
2122#include "test_global_func_ctx_args.skel.h"
2223
2324#include "bpf/libbpf_internal.h"
@@ -155,6 +156,7 @@ void test_test_global_funcs(void)
155156 RUN_TESTS (test_global_func15 );
156157 RUN_TESTS (test_global_func16 );
157158 RUN_TESTS (test_global_func17 );
159+ RUN_TESTS (test_global_func18 );
158160 RUN_TESTS (test_global_func_ctx_args );
159161
160162 if (test__start_subtest ("ctx_arg_rewrite" ))
Original file line number Diff line number Diff line change @@ -29,11 +29,15 @@ struct {
2929private (A ) struct bpf_spin_lock lock ;
3030private (A ) struct bpf_rb_root rbtree __contains (foo , node );
3131
32- __noinline void * exception_cb_bad_ret_type (u64 cookie )
32+ __noinline void * exception_cb_bad_ret_type1 (u64 cookie )
3333{
3434 return NULL ;
3535}
3636
37+ __noinline void exception_cb_bad_ret_type2 (u64 cookie )
38+ {
39+ }
40+
3741__noinline int exception_cb_bad_arg_0 (void )
3842{
3943 return 0 ;
@@ -50,8 +54,8 @@ __noinline int exception_cb_ok_arg_small(int a)
5054}
5155
5256SEC ("?tc" )
53- __exception_cb (exception_cb_bad_ret_type )
54- __failure __msg ("Global function exception_cb_bad_ret_type () return value not void or scalar." )
57+ __exception_cb (exception_cb_bad_ret_type1 )
58+ __failure __msg ("Global function exception_cb_bad_ret_type1 () return value not void or scalar." )
5559int reject_exception_cb_type_1 (struct __sk_buff * ctx )
5660{
5761 bpf_throw (0 );
@@ -85,6 +89,15 @@ int reject_exception_cb_type_4(struct __sk_buff *ctx)
8589 return 0 ;
8690}
8791
92+ SEC ("?tc" )
93+ __exception_cb (exception_cb_bad_ret_type2 )
94+ __failure __msg ("exception cb cannot return void" )
95+ int reject_exception_cb_type_5 (struct __sk_buff * ctx )
96+ {
97+ bpf_throw (0 );
98+ return 0 ;
99+ }
100+
88101__noinline
89102static int timer_cb (void * map , int * key , struct bpf_timer * timer )
90103{
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0-only
2+ #include <vmlinux.h>
3+ #include <bpf/bpf_helpers.h>
4+ #include "bpf_misc.h"
5+
6+ __weak
7+ void foo (void )
8+ {
9+ }
10+
11+ SEC ("tc" )
12+ __failure __msg ("!read_ok" )
13+ int global_func18 (struct __sk_buff * skb )
14+ {
15+ foo ();
16+
17+ asm volatile (
18+ "r1 = r0;"
19+ :::
20+ );
21+
22+ return 0 ;
23+ }
You can’t perform that action at this time.
0 commit comments