aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_align.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/bpf/test_align.c')
-rw-r--r--tools/testing/selftests/bpf/test_align.c178
1 files changed, 97 insertions, 81 deletions
diff --git a/tools/testing/selftests/bpf/test_align.c b/tools/testing/selftests/bpf/test_align.c
index 471bbbdb94db..ff8bd7e3e50c 100644
--- a/tools/testing/selftests/bpf/test_align.c
+++ b/tools/testing/selftests/bpf/test_align.c
@@ -64,11 +64,11 @@ static struct bpf_align_test tests[] = {
64 .matches = { 64 .matches = {
65 {1, "R1=ctx(id=0,off=0,imm=0)"}, 65 {1, "R1=ctx(id=0,off=0,imm=0)"},
66 {1, "R10=fp0"}, 66 {1, "R10=fp0"},
67 {1, "R3=inv2"}, 67 {1, "R3_w=inv2"},
68 {2, "R3=inv4"}, 68 {2, "R3_w=inv4"},
69 {3, "R3=inv8"}, 69 {3, "R3_w=inv8"},
70 {4, "R3=inv16"}, 70 {4, "R3_w=inv16"},
71 {5, "R3=inv32"}, 71 {5, "R3_w=inv32"},
72 }, 72 },
73 }, 73 },
74 { 74 {
@@ -92,17 +92,17 @@ static struct bpf_align_test tests[] = {
92 .matches = { 92 .matches = {
93 {1, "R1=ctx(id=0,off=0,imm=0)"}, 93 {1, "R1=ctx(id=0,off=0,imm=0)"},
94 {1, "R10=fp0"}, 94 {1, "R10=fp0"},
95 {1, "R3=inv1"}, 95 {1, "R3_w=inv1"},
96 {2, "R3=inv2"}, 96 {2, "R3_w=inv2"},
97 {3, "R3=inv4"}, 97 {3, "R3_w=inv4"},
98 {4, "R3=inv8"}, 98 {4, "R3_w=inv8"},
99 {5, "R3=inv16"}, 99 {5, "R3_w=inv16"},
100 {6, "R3=inv1"}, 100 {6, "R3_w=inv1"},
101 {7, "R4=inv32"}, 101 {7, "R4_w=inv32"},
102 {8, "R4=inv16"}, 102 {8, "R4_w=inv16"},
103 {9, "R4=inv8"}, 103 {9, "R4_w=inv8"},
104 {10, "R4=inv4"}, 104 {10, "R4_w=inv4"},
105 {11, "R4=inv2"}, 105 {11, "R4_w=inv2"},
106 }, 106 },
107 }, 107 },
108 { 108 {
@@ -121,12 +121,12 @@ static struct bpf_align_test tests[] = {
121 .matches = { 121 .matches = {
122 {1, "R1=ctx(id=0,off=0,imm=0)"}, 122 {1, "R1=ctx(id=0,off=0,imm=0)"},
123 {1, "R10=fp0"}, 123 {1, "R10=fp0"},
124 {1, "R3=inv4"}, 124 {1, "R3_w=inv4"},
125 {2, "R3=inv8"}, 125 {2, "R3_w=inv8"},
126 {3, "R3=inv10"}, 126 {3, "R3_w=inv10"},
127 {4, "R4=inv8"}, 127 {4, "R4_w=inv8"},
128 {5, "R4=inv12"}, 128 {5, "R4_w=inv12"},
129 {6, "R4=inv14"}, 129 {6, "R4_w=inv14"},
130 }, 130 },
131 }, 131 },
132 { 132 {
@@ -143,10 +143,10 @@ static struct bpf_align_test tests[] = {
143 .matches = { 143 .matches = {
144 {1, "R1=ctx(id=0,off=0,imm=0)"}, 144 {1, "R1=ctx(id=0,off=0,imm=0)"},
145 {1, "R10=fp0"}, 145 {1, "R10=fp0"},
146 {1, "R3=inv7"}, 146 {1, "R3_w=inv7"},
147 {2, "R3=inv7"}, 147 {2, "R3_w=inv7"},
148 {3, "R3=inv14"}, 148 {3, "R3_w=inv14"},
149 {4, "R3=inv56"}, 149 {4, "R3_w=inv56"},
150 }, 150 },
151 }, 151 },
152 152
@@ -185,18 +185,18 @@ static struct bpf_align_test tests[] = {
185 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 185 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
186 .matches = { 186 .matches = {
187 {7, "R0=pkt(id=0,off=8,r=8,imm=0)"}, 187 {7, "R0=pkt(id=0,off=8,r=8,imm=0)"},
188 {7, "R3=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 188 {7, "R3_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
189 {8, "R3=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"}, 189 {8, "R3_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
190 {9, "R3=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 190 {9, "R3_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
191 {10, "R3=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"}, 191 {10, "R3_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
192 {11, "R3=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"}, 192 {11, "R3_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
193 {18, "R3=pkt_end(id=0,off=0,imm=0)"}, 193 {18, "R3=pkt_end(id=0,off=0,imm=0)"},
194 {18, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 194 {18, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
195 {19, "R4=inv(id=0,umax_value=8160,var_off=(0x0; 0x1fe0))"}, 195 {19, "R4_w=inv(id=0,umax_value=8160,var_off=(0x0; 0x1fe0))"},
196 {20, "R4=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"}, 196 {20, "R4_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
197 {21, "R4=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"}, 197 {21, "R4_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
198 {22, "R4=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 198 {22, "R4_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
199 {23, "R4=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"}, 199 {23, "R4_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
200 }, 200 },
201 }, 201 },
202 { 202 {
@@ -217,16 +217,16 @@ static struct bpf_align_test tests[] = {
217 }, 217 },
218 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 218 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
219 .matches = { 219 .matches = {
220 {7, "R3=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 220 {7, "R3_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
221 {8, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 221 {8, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
222 {9, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 222 {9, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
223 {10, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 223 {10, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
224 {11, "R4=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"}, 224 {11, "R4_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
225 {12, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 225 {12, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
226 {13, "R4=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 226 {13, "R4_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
227 {14, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 227 {14, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
228 {15, "R4=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"}, 228 {15, "R4_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
229 {16, "R4=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"}, 229 {16, "R4_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
230 }, 230 },
231 }, 231 },
232 { 232 {
@@ -257,14 +257,14 @@ static struct bpf_align_test tests[] = {
257 }, 257 },
258 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 258 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
259 .matches = { 259 .matches = {
260 {4, "R5=pkt(id=0,off=0,r=0,imm=0)"}, 260 {4, "R5_w=pkt(id=0,off=0,r=0,imm=0)"},
261 {5, "R5=pkt(id=0,off=14,r=0,imm=0)"}, 261 {5, "R5_w=pkt(id=0,off=14,r=0,imm=0)"},
262 {6, "R4=pkt(id=0,off=14,r=0,imm=0)"}, 262 {6, "R4_w=pkt(id=0,off=14,r=0,imm=0)"},
263 {10, "R2=pkt(id=0,off=0,r=18,imm=0)"}, 263 {10, "R2=pkt(id=0,off=0,r=18,imm=0)"},
264 {10, "R5=pkt(id=0,off=14,r=18,imm=0)"}, 264 {10, "R5=pkt(id=0,off=14,r=18,imm=0)"},
265 {10, "R4=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"}, 265 {10, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
266 {14, "R4=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"}, 266 {14, "R4_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"},
267 {15, "R4=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"}, 267 {15, "R4_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"},
268 }, 268 },
269 }, 269 },
270 { 270 {
@@ -320,11 +320,11 @@ static struct bpf_align_test tests[] = {
320 * alignment of 4. 320 * alignment of 4.
321 */ 321 */
322 {8, "R2=pkt(id=0,off=0,r=8,imm=0)"}, 322 {8, "R2=pkt(id=0,off=0,r=8,imm=0)"},
323 {8, "R6=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 323 {8, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
324 /* Offset is added to packet pointer R5, resulting in 324 /* Offset is added to packet pointer R5, resulting in
325 * known fixed offset, and variable offset from R6. 325 * known fixed offset, and variable offset from R6.
326 */ 326 */
327 {11, "R5=pkt(id=1,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 327 {11, "R5_w=pkt(id=1,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
328 /* At the time the word size load is performed from R5, 328 /* At the time the word size load is performed from R5,
329 * it's total offset is NET_IP_ALIGN + reg->off (0) + 329 * it's total offset is NET_IP_ALIGN + reg->off (0) +
330 * reg->aux_off (14) which is 16. Then the variable 330 * reg->aux_off (14) which is 16. Then the variable
@@ -336,11 +336,11 @@ static struct bpf_align_test tests[] = {
336 /* Variable offset is added to R5 packet pointer, 336 /* Variable offset is added to R5 packet pointer,
337 * resulting in auxiliary alignment of 4. 337 * resulting in auxiliary alignment of 4.
338 */ 338 */
339 {18, "R5=pkt(id=2,off=0,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 339 {18, "R5_w=pkt(id=2,off=0,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
340 /* Constant offset is added to R5, resulting in 340 /* Constant offset is added to R5, resulting in
341 * reg->off of 14. 341 * reg->off of 14.
342 */ 342 */
343 {19, "R5=pkt(id=2,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 343 {19, "R5_w=pkt(id=2,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
344 /* At the time the word size load is performed from R5, 344 /* At the time the word size load is performed from R5,
345 * its total fixed offset is NET_IP_ALIGN + reg->off 345 * its total fixed offset is NET_IP_ALIGN + reg->off
346 * (14) which is 16. Then the variable offset is 4-byte 346 * (14) which is 16. Then the variable offset is 4-byte
@@ -352,18 +352,18 @@ static struct bpf_align_test tests[] = {
352 /* Constant offset is added to R5 packet pointer, 352 /* Constant offset is added to R5 packet pointer,
353 * resulting in reg->off value of 14. 353 * resulting in reg->off value of 14.
354 */ 354 */
355 {26, "R5=pkt(id=0,off=14,r=8"}, 355 {26, "R5_w=pkt(id=0,off=14,r=8"},
356 /* Variable offset is added to R5, resulting in a 356 /* Variable offset is added to R5, resulting in a
357 * variable offset of (4n). 357 * variable offset of (4n).
358 */ 358 */
359 {27, "R5=pkt(id=3,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 359 {27, "R5_w=pkt(id=3,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
360 /* Constant is added to R5 again, setting reg->off to 18. */ 360 /* Constant is added to R5 again, setting reg->off to 18. */
361 {28, "R5=pkt(id=3,off=18,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 361 {28, "R5_w=pkt(id=3,off=18,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
362 /* And once more we add a variable; resulting var_off 362 /* And once more we add a variable; resulting var_off
363 * is still (4n), fixed offset is not changed. 363 * is still (4n), fixed offset is not changed.
364 * Also, we create a new reg->id. 364 * Also, we create a new reg->id.
365 */ 365 */
366 {29, "R5=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc))"}, 366 {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc))"},
367 /* At the time the word size load is performed from R5, 367 /* At the time the word size load is performed from R5,
368 * its total fixed offset is NET_IP_ALIGN + reg->off (18) 368 * its total fixed offset is NET_IP_ALIGN + reg->off (18)
369 * which is 20. Then the variable offset is (4n), so 369 * which is 20. Then the variable offset is (4n), so
@@ -410,11 +410,11 @@ static struct bpf_align_test tests[] = {
410 * alignment of 4. 410 * alignment of 4.
411 */ 411 */
412 {8, "R2=pkt(id=0,off=0,r=8,imm=0)"}, 412 {8, "R2=pkt(id=0,off=0,r=8,imm=0)"},
413 {8, "R6=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 413 {8, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
414 /* Adding 14 makes R6 be (4n+2) */ 414 /* Adding 14 makes R6 be (4n+2) */
415 {9, "R6=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, 415 {9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
416 /* Packet pointer has (4n+2) offset */ 416 /* Packet pointer has (4n+2) offset */
417 {11, "R5=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, 417 {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
418 {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, 418 {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
419 /* At the time the word size load is performed from R5, 419 /* At the time the word size load is performed from R5,
420 * its total fixed offset is NET_IP_ALIGN + reg->off (0) 420 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
@@ -426,11 +426,11 @@ static struct bpf_align_test tests[] = {
426 /* Newly read value in R6 was shifted left by 2, so has 426 /* Newly read value in R6 was shifted left by 2, so has
427 * known alignment of 4. 427 * known alignment of 4.
428 */ 428 */
429 {18, "R6=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 429 {18, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
430 /* Added (4n) to packet pointer's (4n+2) var_off, giving 430 /* Added (4n) to packet pointer's (4n+2) var_off, giving
431 * another (4n+2). 431 * another (4n+2).
432 */ 432 */
433 {19, "R5=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, 433 {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"},
434 {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, 434 {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"},
435 /* At the time the word size load is performed from R5, 435 /* At the time the word size load is performed from R5,
436 * its total fixed offset is NET_IP_ALIGN + reg->off (0) 436 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
@@ -446,11 +446,9 @@ static struct bpf_align_test tests[] = {
446 .insns = { 446 .insns = {
447 PREP_PKT_POINTERS, 447 PREP_PKT_POINTERS,
448 BPF_MOV64_IMM(BPF_REG_0, 0), 448 BPF_MOV64_IMM(BPF_REG_0, 0),
449 /* ptr & const => unknown & const */ 449 /* (ptr - ptr) << 2 */
450 BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), 450 BPF_MOV64_REG(BPF_REG_5, BPF_REG_3),
451 BPF_ALU64_IMM(BPF_AND, BPF_REG_5, 0x40), 451 BPF_ALU64_REG(BPF_SUB, BPF_REG_5, BPF_REG_2),
452 /* ptr << const => unknown << const */
453 BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
454 BPF_ALU64_IMM(BPF_LSH, BPF_REG_5, 2), 452 BPF_ALU64_IMM(BPF_LSH, BPF_REG_5, 2),
455 /* We have a (4n) value. Let's make a packet offset 453 /* We have a (4n) value. Let's make a packet offset
456 * out of it. First add 14, to make it a (4n+2) 454 * out of it. First add 14, to make it a (4n+2)
@@ -473,8 +471,26 @@ static struct bpf_align_test tests[] = {
473 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 471 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
474 .result = REJECT, 472 .result = REJECT,
475 .matches = { 473 .matches = {
476 {4, "R5=pkt(id=0,off=0,r=0,imm=0)"}, 474 {4, "R5_w=pkt_end(id=0,off=0,imm=0)"},
477 /* R5 bitwise operator &= on pointer prohibited */ 475 /* (ptr - ptr) << 2 == unknown, (4n) */
476 {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))"},
477 /* (4n) + 14 == (4n+2). We blow our bounds, because
478 * the add could overflow.
479 */
480 {7, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"},
481 /* Checked s>=0 */
482 {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
483 /* packet pointer + nonnegative (4n+2) */
484 {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
485 {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
486 /* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine.
487 * We checked the bounds, but it might have been able
488 * to overflow if the packet pointer started in the
489 * upper half of the address space.
490 * So we did not get a 'range' on R6, and the access
491 * attempt will fail.
492 */
493 {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
478 } 494 }
479 }, 495 },
480 { 496 {
@@ -510,11 +526,11 @@ static struct bpf_align_test tests[] = {
510 * alignment of 4. 526 * alignment of 4.
511 */ 527 */
512 {7, "R2=pkt(id=0,off=0,r=8,imm=0)"}, 528 {7, "R2=pkt(id=0,off=0,r=8,imm=0)"},
513 {9, "R6=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 529 {9, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
514 /* Adding 14 makes R6 be (4n+2) */ 530 /* Adding 14 makes R6 be (4n+2) */
515 {10, "R6=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, 531 {10, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
516 /* New unknown value in R7 is (4n) */ 532 /* New unknown value in R7 is (4n) */
517 {11, "R7=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"}, 533 {11, "R7_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
518 /* Subtracting it from R6 blows our unsigned bounds */ 534 /* Subtracting it from R6 blows our unsigned bounds */
519 {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))"}, 535 {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))"},
520 /* Checked s>= 0 */ 536 /* Checked s>= 0 */
@@ -563,15 +579,15 @@ static struct bpf_align_test tests[] = {
563 * alignment of 4. 579 * alignment of 4.
564 */ 580 */
565 {7, "R2=pkt(id=0,off=0,r=8,imm=0)"}, 581 {7, "R2=pkt(id=0,off=0,r=8,imm=0)"},
566 {10, "R6=inv(id=0,umax_value=60,var_off=(0x0; 0x3c))"}, 582 {10, "R6_w=inv(id=0,umax_value=60,var_off=(0x0; 0x3c))"},
567 /* Adding 14 makes R6 be (4n+2) */ 583 /* Adding 14 makes R6 be (4n+2) */
568 {11, "R6=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"}, 584 {11, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},
569 /* Subtracting from packet pointer overflows ubounds */ 585 /* Subtracting from packet pointer overflows ubounds */
570 {13, "R5=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))"}, 586 {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))"},
571 /* New unknown value in R7 is (4n), >= 76 */ 587 /* New unknown value in R7 is (4n), >= 76 */
572 {15, "R7=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"}, 588 {15, "R7_w=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"},
573 /* Adding it to packet pointer gives nice bounds again */ 589 /* Adding it to packet pointer gives nice bounds again */
574 {16, "R5=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, 590 {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"},
575 /* At the time the word size load is performed from R5, 591 /* At the time the word size load is performed from R5,
576 * its total fixed offset is NET_IP_ALIGN + reg->off (0) 592 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
577 * which is 2. Then the variable offset is (4n+2), so 593 * which is 2. Then the variable offset is (4n+2), so