2 "invalid direct packet write for LWT_IN",
4 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
5 offsetof(struct __sk_buff
, data
)),
6 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
7 offsetof(struct __sk_buff
, data_end
)),
8 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
9 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
10 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
11 BPF_STX_MEM(BPF_B
, BPF_REG_2
, BPF_REG_2
, 0),
12 BPF_MOV64_IMM(BPF_REG_0
, 0),
15 .errstr
= "cannot write into packet",
17 .prog_type
= BPF_PROG_TYPE_LWT_IN
,
20 "invalid direct packet write for LWT_OUT",
22 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
23 offsetof(struct __sk_buff
, data
)),
24 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
25 offsetof(struct __sk_buff
, data_end
)),
26 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
27 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
28 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
29 BPF_STX_MEM(BPF_B
, BPF_REG_2
, BPF_REG_2
, 0),
30 BPF_MOV64_IMM(BPF_REG_0
, 0),
33 .errstr
= "cannot write into packet",
35 .prog_type
= BPF_PROG_TYPE_LWT_OUT
,
38 "direct packet write for LWT_XMIT",
40 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
41 offsetof(struct __sk_buff
, data
)),
42 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
43 offsetof(struct __sk_buff
, data_end
)),
44 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
45 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
46 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
47 BPF_STX_MEM(BPF_B
, BPF_REG_2
, BPF_REG_2
, 0),
48 BPF_MOV64_IMM(BPF_REG_0
, 0),
52 .prog_type
= BPF_PROG_TYPE_LWT_XMIT
,
55 "direct packet read for LWT_IN",
57 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
58 offsetof(struct __sk_buff
, data
)),
59 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
60 offsetof(struct __sk_buff
, data_end
)),
61 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
62 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
63 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
64 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_2
, 0),
65 BPF_MOV64_IMM(BPF_REG_0
, 0),
69 .prog_type
= BPF_PROG_TYPE_LWT_IN
,
72 "direct packet read for LWT_OUT",
74 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
75 offsetof(struct __sk_buff
, data
)),
76 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
77 offsetof(struct __sk_buff
, data_end
)),
78 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
79 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
80 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
81 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_2
, 0),
82 BPF_MOV64_IMM(BPF_REG_0
, 0),
86 .prog_type
= BPF_PROG_TYPE_LWT_OUT
,
89 "direct packet read for LWT_XMIT",
91 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
92 offsetof(struct __sk_buff
, data
)),
93 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
94 offsetof(struct __sk_buff
, data_end
)),
95 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
96 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
97 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
98 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_2
, 0),
99 BPF_MOV64_IMM(BPF_REG_0
, 0),
103 .prog_type
= BPF_PROG_TYPE_LWT_XMIT
,
106 "overlapping checks for direct packet access",
108 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
109 offsetof(struct __sk_buff
, data
)),
110 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
111 offsetof(struct __sk_buff
, data_end
)),
112 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
113 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
114 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 4),
115 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_2
),
116 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 6),
117 BPF_JMP_REG(BPF_JGT
, BPF_REG_1
, BPF_REG_3
, 1),
118 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_2
, 6),
119 BPF_MOV64_IMM(BPF_REG_0
, 0),
123 .prog_type
= BPF_PROG_TYPE_LWT_XMIT
,
126 "make headroom for LWT_XMIT",
128 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_1
),
129 BPF_MOV64_IMM(BPF_REG_2
, 34),
130 BPF_MOV64_IMM(BPF_REG_3
, 0),
131 BPF_EMIT_CALL(BPF_FUNC_skb_change_head
),
132 /* split for s390 to succeed */
133 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_6
),
134 BPF_MOV64_IMM(BPF_REG_2
, 42),
135 BPF_MOV64_IMM(BPF_REG_3
, 0),
136 BPF_EMIT_CALL(BPF_FUNC_skb_change_head
),
137 BPF_MOV64_IMM(BPF_REG_0
, 0),
141 .prog_type
= BPF_PROG_TYPE_LWT_XMIT
,
144 "invalid access of tc_classid for LWT_IN",
146 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
147 offsetof(struct __sk_buff
, tc_classid
)),
151 .errstr
= "invalid bpf_context access",
154 "invalid access of tc_classid for LWT_OUT",
156 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
157 offsetof(struct __sk_buff
, tc_classid
)),
161 .errstr
= "invalid bpf_context access",
164 "invalid access of tc_classid for LWT_XMIT",
166 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
167 offsetof(struct __sk_buff
, tc_classid
)),
171 .errstr
= "invalid bpf_context access",
174 "check skb->tc_classid half load not permitted for lwt prog",
176 BPF_MOV64_IMM(BPF_REG_0
, 0),
177 #if __BYTE_ORDER == __LITTLE_ENDIAN
178 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
179 offsetof(struct __sk_buff
, tc_classid
)),
181 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
182 offsetof(struct __sk_buff
, tc_classid
) + 2),
187 .errstr
= "invalid bpf_context access",
188 .prog_type
= BPF_PROG_TYPE_LWT_IN
,