File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tools/testing/selftests/bpf/progs Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,40 @@ __naked void ctx_access_u32_pointer_accept(void)
29
29
" ::: __clobber_all );
30
30
}
31
31
32
+ SEC ("fentry/bpf_fentry_test9" )
33
+ __description ("btf_ctx_access u32 pointer reject u32" )
34
+ __failure __msg ("size 4 must be 8" )
35
+ __naked void ctx_access_u32_pointer_reject_32 (void )
36
+ {
37
+ asm volatile (" \
38
+ r2 = *(u32 *)(r1 + 0); /* load 1st argument with narrow load */\
39
+ r0 = 0; \
40
+ exit; \
41
+ " ::: __clobber_all );
42
+ }
43
+
44
+ SEC ("fentry/bpf_fentry_test9" )
45
+ __description ("btf_ctx_access u32 pointer reject u16" )
46
+ __failure __msg ("size 2 must be 8" )
47
+ __naked void ctx_access_u32_pointer_reject_16 (void )
48
+ {
49
+ asm volatile (" \
50
+ r2 = *(u16 *)(r1 + 0); /* load 1st argument with narrow load */\
51
+ r0 = 0; \
52
+ exit; \
53
+ " ::: __clobber_all );
54
+ }
55
+
56
+ SEC ("fentry/bpf_fentry_test9" )
57
+ __description ("btf_ctx_access u32 pointer reject u8" )
58
+ __failure __msg ("size 1 must be 8" )
59
+ __naked void ctx_access_u32_pointer_reject_8 (void )
60
+ {
61
+ asm volatile (" \
62
+ r2 = *(u8 *)(r1 + 0); /* load 1st argument with narrow load */\
63
+ r0 = 0; \
64
+ exit; \
65
+ " ::: __clobber_all );
66
+ }
67
+
32
68
char _license [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments