2 "valid access family in SK_MSG",
4 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
5 offsetof(struct sk_msg_md
, family
)),
9 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
12 "valid access remote_ip4 in SK_MSG",
14 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
15 offsetof(struct sk_msg_md
, remote_ip4
)),
19 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
22 "valid access local_ip4 in SK_MSG",
24 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
25 offsetof(struct sk_msg_md
, local_ip4
)),
29 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
32 "valid access remote_port in SK_MSG",
34 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
35 offsetof(struct sk_msg_md
, remote_port
)),
39 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
42 "valid access local_port in SK_MSG",
44 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
45 offsetof(struct sk_msg_md
, local_port
)),
49 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
52 "valid access remote_ip6 in SK_MSG",
54 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
55 offsetof(struct sk_msg_md
, remote_ip6
[0])),
56 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
57 offsetof(struct sk_msg_md
, remote_ip6
[1])),
58 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
59 offsetof(struct sk_msg_md
, remote_ip6
[2])),
60 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
61 offsetof(struct sk_msg_md
, remote_ip6
[3])),
65 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
68 "valid access local_ip6 in SK_MSG",
70 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
71 offsetof(struct sk_msg_md
, local_ip6
[0])),
72 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
73 offsetof(struct sk_msg_md
, local_ip6
[1])),
74 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
75 offsetof(struct sk_msg_md
, local_ip6
[2])),
76 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
77 offsetof(struct sk_msg_md
, local_ip6
[3])),
81 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
84 "valid access size in SK_MSG",
86 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
87 offsetof(struct sk_msg_md
, size
)),
91 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
94 "invalid 64B read of size in SK_MSG",
96 BPF_LDX_MEM(BPF_DW
, BPF_REG_2
, BPF_REG_1
,
97 offsetof(struct sk_msg_md
, size
)),
100 .errstr
= "invalid bpf_context access",
102 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
103 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
106 "invalid read past end of SK_MSG",
108 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
109 offsetof(struct sk_msg_md
, size
) + 4),
112 .errstr
= "invalid bpf_context access",
114 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
117 "invalid read offset in SK_MSG",
119 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
120 offsetof(struct sk_msg_md
, family
) + 1),
123 .errstr
= "invalid bpf_context access",
125 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
126 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
129 "direct packet read for SK_MSG",
131 BPF_LDX_MEM(BPF_DW
, BPF_REG_2
, BPF_REG_1
,
132 offsetof(struct sk_msg_md
, data
)),
133 BPF_LDX_MEM(BPF_DW
, BPF_REG_3
, BPF_REG_1
,
134 offsetof(struct sk_msg_md
, data_end
)),
135 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
136 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
137 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
138 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_2
, 0),
139 BPF_MOV64_IMM(BPF_REG_0
, 0),
143 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
146 "direct packet write for SK_MSG",
148 BPF_LDX_MEM(BPF_DW
, BPF_REG_2
, BPF_REG_1
,
149 offsetof(struct sk_msg_md
, data
)),
150 BPF_LDX_MEM(BPF_DW
, BPF_REG_3
, BPF_REG_1
,
151 offsetof(struct sk_msg_md
, data_end
)),
152 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
153 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
154 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
155 BPF_STX_MEM(BPF_B
, BPF_REG_2
, BPF_REG_2
, 0),
156 BPF_MOV64_IMM(BPF_REG_0
, 0),
160 .prog_type
= BPF_PROG_TYPE_SK_MSG
,
163 "overlapping checks for direct packet access SK_MSG",
165 BPF_LDX_MEM(BPF_DW
, BPF_REG_2
, BPF_REG_1
,
166 offsetof(struct sk_msg_md
, data
)),
167 BPF_LDX_MEM(BPF_DW
, BPF_REG_3
, BPF_REG_1
,
168 offsetof(struct sk_msg_md
, data_end
)),
169 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
170 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
171 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 4),
172 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_2
),
173 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 6),
174 BPF_JMP_REG(BPF_JGT
, BPF_REG_1
, BPF_REG_3
, 1),
175 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_2
, 6),
176 BPF_MOV64_IMM(BPF_REG_0
, 0),
180 .prog_type
= BPF_PROG_TYPE_SK_MSG
,