~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/verifier/jump.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 {
  2         "jump test 1",
  3         .insns = {
  4         BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
  5         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_1, -8),
  6         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),
  7         BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0),
  8         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 1),
  9         BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 1),
 10         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 1),
 11         BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 2),
 12         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 1),
 13         BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 3),
 14         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 1),
 15         BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 4),
 16         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 1),
 17         BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 5),
 18         BPF_MOV64_IMM(BPF_REG_0, 0),
 19         BPF_EXIT_INSN(),
 20         },
 21         .errstr_unpriv = "R1 pointer comparison",
 22         .result_unpriv = REJECT,
 23         .result = ACCEPT,
 24 },
 25 {
 26         "jump test 2",
 27         .insns = {
 28         BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
 29         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 2),
 30         BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0),
 31         BPF_JMP_IMM(BPF_JA, 0, 0, 14),
 32         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 2),
 33         BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 0),
 34         BPF_JMP_IMM(BPF_JA, 0, 0, 11),
 35         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 2),
 36         BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 0),
 37         BPF_JMP_IMM(BPF_JA, 0, 0, 8),
 38         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 2),
 39         BPF_ST_MEM(BPF_DW, BPF_REG_2, -40, 0),
 40         BPF_JMP_IMM(BPF_JA, 0, 0, 5),
 41         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 2),
 42         BPF_ST_MEM(BPF_DW, BPF_REG_2, -48, 0),
 43         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
 44         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 1),
 45         BPF_ST_MEM(BPF_DW, BPF_REG_2, -56, 0),
 46         BPF_MOV64_IMM(BPF_REG_0, 0),
 47         BPF_EXIT_INSN(),
 48         },
 49         .errstr_unpriv = "R1 pointer comparison",
 50         .result_unpriv = REJECT,
 51         .result = ACCEPT,
 52 },
 53 {
 54         "jump test 3",
 55         .insns = {
 56         BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
 57         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 3),
 58         BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0),
 59         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
 60         BPF_JMP_IMM(BPF_JA, 0, 0, 19),
 61         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 3),
 62         BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 0),
 63         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -16),
 64         BPF_JMP_IMM(BPF_JA, 0, 0, 15),
 65         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 3),
 66         BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 0),
 67         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -32),
 68         BPF_JMP_IMM(BPF_JA, 0, 0, 11),
 69         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 3),
 70         BPF_ST_MEM(BPF_DW, BPF_REG_2, -40, 0),
 71         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -40),
 72         BPF_JMP_IMM(BPF_JA, 0, 0, 7),
 73         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 3),
 74         BPF_ST_MEM(BPF_DW, BPF_REG_2, -48, 0),
 75         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -48),
 76         BPF_JMP_IMM(BPF_JA, 0, 0, 3),
 77         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 0),
 78         BPF_ST_MEM(BPF_DW, BPF_REG_2, -56, 0),
 79         BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -56),
 80         BPF_LD_MAP_FD(BPF_REG_1, 0),
 81         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_delete_elem),
 82         BPF_EXIT_INSN(),
 83         },
 84         .fixup_map_hash_8b = { 24 },
 85         .errstr_unpriv = "R1 pointer comparison",
 86         .result_unpriv = REJECT,
 87         .result = ACCEPT,
 88         .retval = -ENOENT,
 89 },
 90 {
 91         "jump test 4",
 92         .insns = {
 93         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
 94         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
 95         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
 96         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
 97         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
 98         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
 99         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
100         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
101         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
102         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
103         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
104         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
105         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
106         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
107         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
108         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
109         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
110         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
111         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
112         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
113         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
114         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
115         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
116         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
117         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
118         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
119         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
120         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
121         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
122         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
123         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
124         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
125         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1),
126         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2),
127         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3),
128         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4),
129         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0),
130         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0),
131         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0),
132         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0),
133         BPF_MOV64_IMM(BPF_REG_0, 0),
134         BPF_EXIT_INSN(),
135         },
136         .errstr_unpriv = "R1 pointer comparison",
137         .result_unpriv = REJECT,
138         .result = ACCEPT,
139 },
140 {
141         "jump test 5",
142         .insns = {
143         BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
144         BPF_MOV64_REG(BPF_REG_3, BPF_REG_2),
145         BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
146         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
147         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
148         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
149         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
150         BPF_MOV64_IMM(BPF_REG_0, 0),
151         BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
152         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
153         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
154         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
155         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
156         BPF_MOV64_IMM(BPF_REG_0, 0),
157         BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
158         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
159         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
160         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
161         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
162         BPF_MOV64_IMM(BPF_REG_0, 0),
163         BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
164         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
165         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
166         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
167         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
168         BPF_MOV64_IMM(BPF_REG_0, 0),
169         BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
170         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
171         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
172         BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
173         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
174         BPF_MOV64_IMM(BPF_REG_0, 0),
175         BPF_EXIT_INSN(),
176         },
177         .errstr_unpriv = "R1 pointer comparison",
178         .result_unpriv = REJECT,
179         .result = ACCEPT,
180 },
181 {
182         "jump test 6",
183         .insns = {
184         BPF_MOV64_IMM(BPF_REG_0, 1),
185         BPF_MOV64_IMM(BPF_REG_1, 2),
186         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
187         BPF_MOV64_IMM(BPF_REG_0, 2),
188         BPF_EXIT_INSN(),
189         BPF_JMP_REG(BPF_JNE, BPF_REG_0, BPF_REG_1, 16),
190         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
191         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
192         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
193         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
194         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
195         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
196         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
197         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
198         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
199         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
200         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
201         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
202         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
203         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
204         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
205         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
206         BPF_JMP_IMM(BPF_JA, 0, 0, -20),
207         },
208         .result = ACCEPT,
209         .retval = 2,
210 },
211 {
212         "jump test 7",
213         .insns = {
214         BPF_MOV64_IMM(BPF_REG_0, 1),
215         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
216         BPF_MOV64_IMM(BPF_REG_0, 3),
217         BPF_EXIT_INSN(),
218         BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16),
219         BPF_MOV64_IMM(BPF_REG_0, 42),
220         BPF_MOV64_IMM(BPF_REG_0, 42),
221         BPF_MOV64_IMM(BPF_REG_0, 42),
222         BPF_MOV64_IMM(BPF_REG_0, 42),
223         BPF_MOV64_IMM(BPF_REG_0, 42),
224         BPF_MOV64_IMM(BPF_REG_0, 42),
225         BPF_MOV64_IMM(BPF_REG_0, 42),
226         BPF_MOV64_IMM(BPF_REG_0, 42),
227         BPF_MOV64_IMM(BPF_REG_0, 42),
228         BPF_MOV64_IMM(BPF_REG_0, 42),
229         BPF_MOV64_IMM(BPF_REG_0, 42),
230         BPF_MOV64_IMM(BPF_REG_0, 42),
231         BPF_MOV64_IMM(BPF_REG_0, 42),
232         BPF_MOV64_IMM(BPF_REG_0, 42),
233         BPF_MOV64_IMM(BPF_REG_0, 42),
234         BPF_MOV64_IMM(BPF_REG_0, 42),
235         BPF_JMP_IMM(BPF_JA, 0, 0, -20),
236         },
237         .result = ACCEPT,
238         .retval = 3,
239 },
240 {
241         "jump test 8",
242         .insns = {
243         BPF_MOV64_IMM(BPF_REG_0, 1),
244         BPF_MOV64_IMM(BPF_REG_1, 2),
245         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
246         BPF_MOV64_IMM(BPF_REG_0, 3),
247         BPF_EXIT_INSN(),
248         BPF_JMP_REG(BPF_JNE, BPF_REG_0, BPF_REG_1, 16),
249         BPF_MOV64_IMM(BPF_REG_0, 42),
250         BPF_MOV64_IMM(BPF_REG_0, 42),
251         BPF_MOV64_IMM(BPF_REG_0, 42),
252         BPF_MOV64_IMM(BPF_REG_0, 42),
253         BPF_MOV64_IMM(BPF_REG_0, 42),
254         BPF_MOV64_IMM(BPF_REG_0, 42),
255         BPF_MOV64_IMM(BPF_REG_0, 42),
256         BPF_MOV64_IMM(BPF_REG_0, 42),
257         BPF_MOV64_IMM(BPF_REG_0, 42),
258         BPF_MOV64_IMM(BPF_REG_0, 42),
259         BPF_MOV64_IMM(BPF_REG_0, 42),
260         BPF_MOV64_IMM(BPF_REG_0, 42),
261         BPF_MOV64_IMM(BPF_REG_0, 42),
262         BPF_MOV64_IMM(BPF_REG_0, 42),
263         BPF_MOV64_IMM(BPF_REG_0, 42),
264         BPF_MOV64_IMM(BPF_REG_0, 42),
265         BPF_JMP_IMM(BPF_JA, 0, 0, -20),
266         },
267         .result = ACCEPT,
268         .retval = 3,
269 },
270 {
271         "jump/call test 9",
272         .insns = {
273         BPF_MOV64_IMM(BPF_REG_0, 1),
274         BPF_JMP_IMM(BPF_JA, 0, 0, 2),
275         BPF_MOV64_IMM(BPF_REG_0, 3),
276         BPF_EXIT_INSN(),
277         BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16),
278         BPF_MOV64_IMM(BPF_REG_0, 42),
279         BPF_MOV64_IMM(BPF_REG_0, 42),
280         BPF_MOV64_IMM(BPF_REG_0, 42),
281         BPF_MOV64_IMM(BPF_REG_0, 42),
282         BPF_MOV64_IMM(BPF_REG_0, 42),
283         BPF_MOV64_IMM(BPF_REG_0, 42),
284         BPF_MOV64_IMM(BPF_REG_0, 42),
285         BPF_MOV64_IMM(BPF_REG_0, 42),
286         BPF_MOV64_IMM(BPF_REG_0, 42),
287         BPF_MOV64_IMM(BPF_REG_0, 42),
288         BPF_MOV64_IMM(BPF_REG_0, 42),
289         BPF_MOV64_IMM(BPF_REG_0, 42),
290         BPF_MOV64_IMM(BPF_REG_0, 42),
291         BPF_MOV64_IMM(BPF_REG_0, 42),
292         BPF_MOV64_IMM(BPF_REG_0, 42),
293         BPF_MOV64_IMM(BPF_REG_0, 42),
294         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -20),
295         BPF_EXIT_INSN(),
296         },
297         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
298         .result = REJECT,
299         .errstr = "jump out of range from insn 1 to 4",
300 },
301 {
302         "jump/call test 10",
303         .insns = {
304         BPF_MOV64_IMM(BPF_REG_0, 1),
305         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
306         BPF_MOV64_IMM(BPF_REG_0, 3),
307         BPF_EXIT_INSN(),
308         BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16),
309         BPF_MOV64_IMM(BPF_REG_0, 42),
310         BPF_MOV64_IMM(BPF_REG_0, 42),
311         BPF_MOV64_IMM(BPF_REG_0, 42),
312         BPF_MOV64_IMM(BPF_REG_0, 42),
313         BPF_MOV64_IMM(BPF_REG_0, 42),
314         BPF_MOV64_IMM(BPF_REG_0, 42),
315         BPF_MOV64_IMM(BPF_REG_0, 42),
316         BPF_MOV64_IMM(BPF_REG_0, 42),
317         BPF_MOV64_IMM(BPF_REG_0, 42),
318         BPF_MOV64_IMM(BPF_REG_0, 42),
319         BPF_MOV64_IMM(BPF_REG_0, 42),
320         BPF_MOV64_IMM(BPF_REG_0, 42),
321         BPF_MOV64_IMM(BPF_REG_0, 42),
322         BPF_MOV64_IMM(BPF_REG_0, 42),
323         BPF_MOV64_IMM(BPF_REG_0, 42),
324         BPF_MOV64_IMM(BPF_REG_0, 42),
325         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -20),
326         BPF_EXIT_INSN(),
327         },
328         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
329         .result = REJECT,
330         .errstr = "last insn is not an exit or jmp",
331 },
332 {
333         "jump/call test 11",
334         .insns = {
335         BPF_MOV64_IMM(BPF_REG_0, 1),
336         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 4),
337         BPF_MOV64_IMM(BPF_REG_0, 3),
338         BPF_EXIT_INSN(),
339         BPF_MOV64_IMM(BPF_REG_0, 3),
340         BPF_EXIT_INSN(),
341         BPF_MOV64_IMM(BPF_REG_0, 1),
342         BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 26),
343         BPF_MOV64_IMM(BPF_REG_0, 42),
344         BPF_MOV64_IMM(BPF_REG_0, 42),
345         BPF_MOV64_IMM(BPF_REG_0, 42),
346         BPF_MOV64_IMM(BPF_REG_0, 42),
347         BPF_MOV64_IMM(BPF_REG_0, 42),
348         BPF_MOV64_IMM(BPF_REG_0, 42),
349         BPF_MOV64_IMM(BPF_REG_0, 42),
350         BPF_MOV64_IMM(BPF_REG_0, 42),
351         BPF_MOV64_IMM(BPF_REG_0, 42),
352         BPF_MOV64_IMM(BPF_REG_0, 42),
353         BPF_MOV64_IMM(BPF_REG_0, 42),
354         BPF_MOV64_IMM(BPF_REG_0, 42),
355         BPF_MOV64_IMM(BPF_REG_0, 42),
356         BPF_MOV64_IMM(BPF_REG_0, 42),
357         BPF_MOV64_IMM(BPF_REG_0, 42),
358         BPF_MOV64_IMM(BPF_REG_0, 42),
359         BPF_MOV64_IMM(BPF_REG_0, 42),
360         BPF_MOV64_IMM(BPF_REG_0, 42),
361         BPF_MOV64_IMM(BPF_REG_0, 42),
362         BPF_MOV64_IMM(BPF_REG_0, 42),
363         BPF_MOV64_IMM(BPF_REG_0, 42),
364         BPF_MOV64_IMM(BPF_REG_0, 42),
365         BPF_MOV64_IMM(BPF_REG_0, 42),
366         BPF_MOV64_IMM(BPF_REG_0, 42),
367         BPF_MOV64_IMM(BPF_REG_0, 42),
368         BPF_MOV64_IMM(BPF_REG_0, 42),
369         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -31),
370         BPF_EXIT_INSN(),
371         },
372         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
373         .result = ACCEPT,
374         .retval = 3,
375 },
376 {
377         "jump & dead code elimination",
378         .insns = {
379         BPF_MOV64_IMM(BPF_REG_0, 1),
380         BPF_MOV64_IMM(BPF_REG_3, 0),
381         BPF_ALU64_IMM(BPF_NEG, BPF_REG_3, 0),
382         BPF_ALU64_IMM(BPF_NEG, BPF_REG_3, 0),
383         BPF_ALU64_IMM(BPF_OR, BPF_REG_3, 32767),
384         BPF_JMP_IMM(BPF_JSGE, BPF_REG_3, 0, 1),
385         BPF_EXIT_INSN(),
386         BPF_JMP_IMM(BPF_JSLE, BPF_REG_3, 0x8000, 1),
387         BPF_EXIT_INSN(),
388         BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, -32767),
389         BPF_MOV64_IMM(BPF_REG_0, 2),
390         BPF_JMP_IMM(BPF_JLE, BPF_REG_3, 0, 1),
391         BPF_MOV64_REG(BPF_REG_0, BPF_REG_4),
392         BPF_EXIT_INSN(),
393         },
394         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
395         .result = ACCEPT,
396         .retval = 2,
397 },
398 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php