File tree Expand file tree Collapse file tree
tools/testing/selftests/bpf Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919#include "verifier_const_or.skel.h"
2020#include "verifier_ctx.skel.h"
2121#include "verifier_ctx_sk_msg.skel.h"
22+ #include "verifier_d_path.skel.h"
2223#include "verifier_direct_stack_access_wraparound.skel.h"
2324#include "verifier_div0.skel.h"
2425#include "verifier_div_overflow.skel.h"
@@ -99,6 +100,7 @@ void test_verifier_cgroup_storage(void) { RUN(verifier_cgroup_storage); }
99100void test_verifier_const_or (void ) { RUN (verifier_const_or ); }
100101void test_verifier_ctx (void ) { RUN (verifier_ctx ); }
101102void test_verifier_ctx_sk_msg (void ) { RUN (verifier_ctx_sk_msg ); }
103+ void test_verifier_d_path (void ) { RUN (verifier_d_path ); }
102104void test_verifier_direct_stack_access_wraparound (void ) { RUN (verifier_direct_stack_access_wraparound ); }
103105void test_verifier_div0 (void ) { RUN (verifier_div0 ); }
104106void test_verifier_div_overflow (void ) { RUN (verifier_div_overflow ); }
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ /* Converted from tools/testing/selftests/bpf/verifier/d_path.c */
3+
4+ #include <linux/bpf.h>
5+ #include <bpf/bpf_helpers.h>
6+ #include "bpf_misc.h"
7+
8+ SEC ("fentry/dentry_open" )
9+ __description ("d_path accept" )
10+ __success __retval (0 )
11+ __naked void d_path_accept (void )
12+ {
13+ asm volatile (" \
14+ r1 = *(u32*)(r1 + 0); \
15+ r2 = r10; \
16+ r2 += -8; \
17+ r6 = 0; \
18+ *(u64*)(r2 + 0) = r6; \
19+ r3 = 8 ll; \
20+ call %[bpf_d_path]; \
21+ r0 = 0; \
22+ exit; \
23+ " :
24+ : __imm (bpf_d_path )
25+ : __clobber_all );
26+ }
27+
28+ SEC ("fentry/d_path" )
29+ __description ("d_path reject" )
30+ __failure __msg ("helper call is not allowed in probe" )
31+ __naked void d_path_reject (void )
32+ {
33+ asm volatile (" \
34+ r1 = *(u32*)(r1 + 0); \
35+ r2 = r10; \
36+ r2 += -8; \
37+ r6 = 0; \
38+ *(u64*)(r2 + 0) = r6; \
39+ r3 = 8 ll; \
40+ call %[bpf_d_path]; \
41+ r0 = 0; \
42+ exit; \
43+ " :
44+ : __imm (bpf_d_path )
45+ : __clobber_all );
46+ }
47+
48+ char _license [] SEC ("license" ) = "GPL" ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments