1- #define BPF_SOCK_ADDR_STORE (field , off , res , err ) \
1+ #define BPF_SOCK_ADDR_STORE (field , off , res , err , flgs ) \
22{ \
33 "wide store to bpf_sock_addr." #field "[" #off "]", \
44 .insns = { \
1111 .prog_type = BPF_PROG_TYPE_CGROUP_SOCK_ADDR, \
1212 .expected_attach_type = BPF_CGROUP_UDP6_SENDMSG, \
1313 .errstr = err, \
14+ .flags = flgs, \
1415}
1516
1617/* user_ip6[0] is u64 aligned */
1718BPF_SOCK_ADDR_STORE (user_ip6 , 0 , ACCEPT ,
18- NULL ),
19+ NULL , 0 ),
1920BPF_SOCK_ADDR_STORE (user_ip6 , 1 , REJECT ,
20- "invalid bpf_context access off=12 size=8" ),
21+ "invalid bpf_context access off=12 size=8" ,
22+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
2123BPF_SOCK_ADDR_STORE (user_ip6 , 2 , ACCEPT ,
22- NULL ),
24+ NULL , 0 ),
2325BPF_SOCK_ADDR_STORE (user_ip6 , 3 , REJECT ,
24- "invalid bpf_context access off=20 size=8" ),
26+ "invalid bpf_context access off=20 size=8" ,
27+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
2528
2629/* msg_src_ip6[0] is _not_ u64 aligned */
2730BPF_SOCK_ADDR_STORE (msg_src_ip6 , 0 , REJECT ,
28- "invalid bpf_context access off=44 size=8" ),
31+ "invalid bpf_context access off=44 size=8" ,
32+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
2933BPF_SOCK_ADDR_STORE (msg_src_ip6 , 1 , ACCEPT ,
30- NULL ),
34+ NULL , 0 ),
3135BPF_SOCK_ADDR_STORE (msg_src_ip6 , 2 , REJECT ,
32- "invalid bpf_context access off=52 size=8" ),
36+ "invalid bpf_context access off=52 size=8" ,
37+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
3338BPF_SOCK_ADDR_STORE (msg_src_ip6 , 3 , REJECT ,
34- "invalid bpf_context access off=56 size=8" ),
39+ "invalid bpf_context access off=56 size=8" , 0 ),
3540
3641#undef BPF_SOCK_ADDR_STORE
3742
38- #define BPF_SOCK_ADDR_LOAD (field , off , res , err ) \
43+ #define BPF_SOCK_ADDR_LOAD (field , off , res , err , flgs ) \
3944{ \
4045 "wide load from bpf_sock_addr." #field "[" #off "]", \
4146 .insns = { \
@@ -48,26 +53,31 @@ BPF_SOCK_ADDR_STORE(msg_src_ip6, 3, REJECT,
4853 .prog_type = BPF_PROG_TYPE_CGROUP_SOCK_ADDR, \
4954 .expected_attach_type = BPF_CGROUP_UDP6_SENDMSG, \
5055 .errstr = err, \
56+ .flags = flgs, \
5157}
5258
5359/* user_ip6[0] is u64 aligned */
5460BPF_SOCK_ADDR_LOAD (user_ip6 , 0 , ACCEPT ,
55- NULL ),
61+ NULL , 0 ),
5662BPF_SOCK_ADDR_LOAD (user_ip6 , 1 , REJECT ,
57- "invalid bpf_context access off=12 size=8" ),
63+ "invalid bpf_context access off=12 size=8" ,
64+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
5865BPF_SOCK_ADDR_LOAD (user_ip6 , 2 , ACCEPT ,
59- NULL ),
66+ NULL , 0 ),
6067BPF_SOCK_ADDR_LOAD (user_ip6 , 3 , REJECT ,
61- "invalid bpf_context access off=20 size=8" ),
68+ "invalid bpf_context access off=20 size=8" ,
69+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
6270
6371/* msg_src_ip6[0] is _not_ u64 aligned */
6472BPF_SOCK_ADDR_LOAD (msg_src_ip6 , 0 , REJECT ,
65- "invalid bpf_context access off=44 size=8" ),
73+ "invalid bpf_context access off=44 size=8" ,
74+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
6675BPF_SOCK_ADDR_LOAD (msg_src_ip6 , 1 , ACCEPT ,
67- NULL ),
76+ NULL , 0 ),
6877BPF_SOCK_ADDR_LOAD (msg_src_ip6 , 2 , REJECT ,
69- "invalid bpf_context access off=52 size=8" ),
78+ "invalid bpf_context access off=52 size=8" ,
79+ F_NEEDS_EFFICIENT_UNALIGNED_ACCESS ),
7080BPF_SOCK_ADDR_LOAD (msg_src_ip6 , 3 , REJECT ,
71- "invalid bpf_context access off=56 size=8" ),
81+ "invalid bpf_context access off=56 size=8" , 0 ),
7282
7383#undef BPF_SOCK_ADDR_LOAD
0 commit comments