1 // SPDX-License-Identifier: GPL-2.0
2 /* Converted from tools/testing/selftests/bpf/verifier/int_ptr.c */
5 #include <bpf/bpf_helpers.h>
9 __description("arg pointer to long uninitialized")
11 __naked void arg_ptr_to_long_uninitialized(void)
14 /* bpf_strtoul arg1 (buf) */ \
18 *(u64*)(r7 + 0) = r0; \
20 /* bpf_strtoul arg2 (buf_len) */ \
22 /* bpf_strtoul arg3 (flags) */ \
24 /* bpf_strtoul arg4 (res) */ \
28 call %[bpf_strtoul]; \
37 __description("arg pointer to long half-uninitialized")
40 __naked void ptr_to_long_half_uninitialized(void)
43 /* bpf_strtoul arg1 (buf) */ \
47 *(u64*)(r7 + 0) = r0; \
49 /* bpf_strtoul arg2 (buf_len) */ \
51 /* bpf_strtoul arg3 (flags) */ \
53 /* bpf_strtoul arg4 (res) */ \
55 *(u32*)(r7 + 0) = r0; \
58 call %[bpf_strtoul]; \
67 __description("arg pointer to long misaligned")
68 __failure __msg("misaligned stack access off 0+-20+0 size 8")
69 __naked void arg_ptr_to_long_misaligned(void)
72 /* bpf_strtoul arg1 (buf) */ \
76 *(u64*)(r7 + 0) = r0; \
78 /* bpf_strtoul arg2 (buf_len) */ \
80 /* bpf_strtoul arg3 (flags) */ \
82 /* bpf_strtoul arg4 (res) */ \
85 *(u32*)(r7 + 0) = r0; \
86 *(u64*)(r7 + 4) = r0; \
89 call %[bpf_strtoul]; \
98 __description("arg pointer to long size < sizeof(long)")
99 __failure __msg("invalid indirect access to stack R4 off=-4 size=8")
100 __naked void to_long_size_sizeof_long(void)
103 /* bpf_strtoul arg1 (buf) */ \
107 *(u64*)(r7 + 0) = r0; \
109 /* bpf_strtoul arg2 (buf_len) */ \
111 /* bpf_strtoul arg3 (flags) */ \
113 /* bpf_strtoul arg4 (res) */ \
115 *(u32*)(r7 + 0) = r0; \
117 /* bpf_strtoul() */ \
118 call %[bpf_strtoul]; \
127 __description("arg pointer to long initialized")
129 __naked void arg_ptr_to_long_initialized(void)
132 /* bpf_strtoul arg1 (buf) */ \
136 *(u64*)(r7 + 0) = r0; \
138 /* bpf_strtoul arg2 (buf_len) */ \
140 /* bpf_strtoul arg3 (flags) */ \
142 /* bpf_strtoul arg4 (res) */ \
144 *(u64*)(r7 + 0) = r0; \
146 /* bpf_strtoul() */ \
147 call %[bpf_strtoul]; \
155 char _license[] SEC("license") = "GPL";