@@ -64,11 +64,11 @@ static struct bpf_align_test tests[] = {
64
64
.matches = {
65
65
{1 , "R1=ctx(id=0,off=0,imm=0)" },
66
66
{1 , "R10=fp0" },
67
- {1 , "R3 =inv2" },
68
- {2 , "R3 =inv4" },
69
- {3 , "R3 =inv8" },
70
- {4 , "R3 =inv16" },
71
- {5 , "R3 =inv32" },
67
+ {1 , "R3_w =inv2" },
68
+ {2 , "R3_w =inv4" },
69
+ {3 , "R3_w =inv8" },
70
+ {4 , "R3_w =inv16" },
71
+ {5 , "R3_w =inv32" },
72
72
},
73
73
},
74
74
{
@@ -92,17 +92,17 @@ static struct bpf_align_test tests[] = {
92
92
.matches = {
93
93
{1 , "R1=ctx(id=0,off=0,imm=0)" },
94
94
{1 , "R10=fp0" },
95
- {1 , "R3 =inv1" },
96
- {2 , "R3 =inv2" },
97
- {3 , "R3 =inv4" },
98
- {4 , "R3 =inv8" },
99
- {5 , "R3 =inv16" },
100
- {6 , "R3 =inv1" },
101
- {7 , "R4 =inv32" },
102
- {8 , "R4 =inv16" },
103
- {9 , "R4 =inv8" },
104
- {10 , "R4 =inv4" },
105
- {11 , "R4 =inv2" },
95
+ {1 , "R3_w =inv1" },
96
+ {2 , "R3_w =inv2" },
97
+ {3 , "R3_w =inv4" },
98
+ {4 , "R3_w =inv8" },
99
+ {5 , "R3_w =inv16" },
100
+ {6 , "R3_w =inv1" },
101
+ {7 , "R4_w =inv32" },
102
+ {8 , "R4_w =inv16" },
103
+ {9 , "R4_w =inv8" },
104
+ {10 , "R4_w =inv4" },
105
+ {11 , "R4_w =inv2" },
106
106
},
107
107
},
108
108
{
@@ -121,12 +121,12 @@ static struct bpf_align_test tests[] = {
121
121
.matches = {
122
122
{1 , "R1=ctx(id=0,off=0,imm=0)" },
123
123
{1 , "R10=fp0" },
124
- {1 , "R3 =inv4" },
125
- {2 , "R3 =inv8" },
126
- {3 , "R3 =inv10" },
127
- {4 , "R4 =inv8" },
128
- {5 , "R4 =inv12" },
129
- {6 , "R4 =inv14" },
124
+ {1 , "R3_w =inv4" },
125
+ {2 , "R3_w =inv8" },
126
+ {3 , "R3_w =inv10" },
127
+ {4 , "R4_w =inv8" },
128
+ {5 , "R4_w =inv12" },
129
+ {6 , "R4_w =inv14" },
130
130
},
131
131
},
132
132
{
@@ -143,10 +143,10 @@ static struct bpf_align_test tests[] = {
143
143
.matches = {
144
144
{1 , "R1=ctx(id=0,off=0,imm=0)" },
145
145
{1 , "R10=fp0" },
146
- {1 , "R3 =inv7" },
147
- {2 , "R3 =inv7" },
148
- {3 , "R3 =inv14" },
149
- {4 , "R3 =inv56" },
146
+ {1 , "R3_w =inv7" },
147
+ {2 , "R3_w =inv7" },
148
+ {3 , "R3_w =inv14" },
149
+ {4 , "R3_w =inv56" },
150
150
},
151
151
},
152
152
@@ -185,18 +185,18 @@ static struct bpf_align_test tests[] = {
185
185
.prog_type = BPF_PROG_TYPE_SCHED_CLS ,
186
186
.matches = {
187
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))" },
189
- {8 , "R3 =inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))" },
190
- {9 , "R3 =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
191
- {10 , "R3 =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
192
- {11 , "R3 =inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))" },
188
+ {7 , "R3_w =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
189
+ {8 , "R3_w =inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))" },
190
+ {9 , "R3_w =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
191
+ {10 , "R3_w =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
192
+ {11 , "R3_w =inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))" },
193
193
{18 , "R3=pkt_end(id=0,off=0,imm=0)" },
194
- {18 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
195
- {19 , "R4 =inv(id=0,umax_value=8160,var_off=(0x0; 0x1fe0))" },
196
- {20 , "R4 =inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))" },
197
- {21 , "R4 =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
198
- {22 , "R4 =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
199
- {23 , "R4 =inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))" },
194
+ {18 , "R4_w =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
195
+ {19 , "R4_w =inv(id=0,umax_value=8160,var_off=(0x0; 0x1fe0))" },
196
+ {20 , "R4_w =inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))" },
197
+ {21 , "R4_w =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
198
+ {22 , "R4_w =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
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
218
.prog_type = BPF_PROG_TYPE_SCHED_CLS ,
219
219
.matches = {
220
- {7 , "R3 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
221
- {8 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
222
- {9 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
223
- {10 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
224
- {11 , "R4 =inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))" },
225
- {12 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
226
- {13 , "R4 =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
227
- {14 , "R4 =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
228
- {15 , "R4 =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
229
- {16 , "R4 =inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))" },
220
+ {7 , "R3_w =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_w =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_w =inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))" },
225
+ {12 , "R4_w =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
226
+ {13 , "R4_w =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
227
+ {14 , "R4_w =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
228
+ {15 , "R4_w =inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))" },
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
258
.prog_type = BPF_PROG_TYPE_SCHED_CLS ,
259
259
.matches = {
260
- {4 , "R5 =pkt(id=0,off=0,r=0,imm=0)" },
261
- {5 , "R5 =pkt(id=0,off=14,r=0,imm=0)" },
262
- {6 , "R4 =pkt(id=0,off=14,r=0,imm=0)" },
260
+ {4 , "R5_w =pkt(id=0,off=0,r=0,imm=0)" },
261
+ {5 , "R5_w =pkt(id=0,off=14,r=0,imm=0)" },
262
+ {6 , "R4_w =pkt(id=0,off=14,r=0,imm=0)" },
263
263
{10 , "R2=pkt(id=0,off=0,r=18,imm=0)" },
264
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))" },
266
- {14 , "R4 =inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))" },
267
- {15 , "R4 =inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))" },
265
+ {10 , "R4_w =inv(id=0,umax_value=255,var_off=(0x0; 0xff))" },
266
+ {14 , "R4_w =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
320
* alignment of 4.
321
321
*/
322
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
324
/* Offset is added to packet pointer R5, resulting in
325
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
328
/* At the time the word size load is performed from R5,
329
329
* it's total offset is NET_IP_ALIGN + reg->off (0) +
330
330
* reg->aux_off (14) which is 16. Then the variable
@@ -336,11 +336,11 @@ static struct bpf_align_test tests[] = {
336
336
/* Variable offset is added to R5 packet pointer,
337
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
340
/* Constant offset is added to R5, resulting in
341
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
344
/* At the time the word size load is performed from R5,
345
345
* its total fixed offset is NET_IP_ALIGN + reg->off
346
346
* (14) which is 16. Then the variable offset is 4-byte
@@ -352,18 +352,18 @@ static struct bpf_align_test tests[] = {
352
352
/* Constant offset is added to R5 packet pointer,
353
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
356
/* Variable offset is added to R5, resulting in a
357
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
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
362
/* And once more we add a variable; resulting var_off
363
363
* is still (4n), fixed offset is not changed.
364
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
367
/* At the time the word size load is performed from R5,
368
368
* its total fixed offset is NET_IP_ALIGN + reg->off (18)
369
369
* which is 20. Then the variable offset is (4n), so
@@ -410,11 +410,11 @@ static struct bpf_align_test tests[] = {
410
410
* alignment of 4.
411
411
*/
412
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
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
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
418
{13 , "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))" },
419
419
/* At the time the word size load is performed from R5,
420
420
* its total fixed offset is NET_IP_ALIGN + reg->off (0)
@@ -426,11 +426,11 @@ static struct bpf_align_test tests[] = {
426
426
/* Newly read value in R6 was shifted left by 2, so has
427
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
430
/* Added (4n) to packet pointer's (4n+2) var_off, giving
431
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
434
{21 , "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))" },
435
435
/* At the time the word size load is performed from R5,
436
436
* its total fixed offset is NET_IP_ALIGN + reg->off (0)
@@ -473,19 +473,19 @@ static struct bpf_align_test tests[] = {
473
473
.prog_type = BPF_PROG_TYPE_SCHED_CLS ,
474
474
.result = REJECT ,
475
475
.matches = {
476
- {4 , "R5 =pkt(id=0,off=0,r=0,imm=0)" },
476
+ {4 , "R5_w =pkt(id=0,off=0,r=0,imm=0)" },
477
477
/* ptr & 0x40 == either 0 or 0x40 */
478
- {5 , "R5 =inv(id=0,umax_value=64,var_off=(0x0; 0x40))" },
478
+ {5 , "R5_w =inv(id=0,umax_value=64,var_off=(0x0; 0x40))" },
479
479
/* ptr << 2 == unknown, (4n) */
480
- {7 , "R5 =inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))" },
480
+ {7 , "R5_w =inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))" },
481
481
/* (4n) + 14 == (4n+2). We blow our bounds, because
482
482
* the add could overflow.
483
483
*/
484
484
{8 , "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))" },
485
485
/* Checked s>=0 */
486
486
{10 , "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))" },
487
487
/* packet pointer + nonnegative (4n+2) */
488
- {12 , "R6 =pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))" },
488
+ {12 , "R6_w =pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))" },
489
489
{14 , "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))" },
490
490
/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine.
491
491
* We checked the bounds, but it might have been able
@@ -530,11 +530,11 @@ static struct bpf_align_test tests[] = {
530
530
* alignment of 4.
531
531
*/
532
532
{7 , "R2=pkt(id=0,off=0,r=8,imm=0)" },
533
- {9 , "R6 =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
533
+ {9 , "R6_w =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
534
534
/* Adding 14 makes R6 be (4n+2) */
535
- {10 , "R6 =inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))" },
535
+ {10 , "R6_w =inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))" },
536
536
/* New unknown value in R7 is (4n) */
537
- {11 , "R7 =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
537
+ {11 , "R7_w =inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))" },
538
538
/* Subtracting it from R6 blows our unsigned bounds */
539
539
{12 , "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))" },
540
540
/* Checked s>= 0 */
@@ -583,15 +583,15 @@ static struct bpf_align_test tests[] = {
583
583
* alignment of 4.
584
584
*/
585
585
{7 , "R2=pkt(id=0,off=0,r=8,imm=0)" },
586
- {10 , "R6 =inv(id=0,umax_value=60,var_off=(0x0; 0x3c))" },
586
+ {10 , "R6_w =inv(id=0,umax_value=60,var_off=(0x0; 0x3c))" },
587
587
/* Adding 14 makes R6 be (4n+2) */
588
- {11 , "R6 =inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))" },
588
+ {11 , "R6_w =inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))" },
589
589
/* Subtracting from packet pointer overflows ubounds */
590
- {13 , "R5 =pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))" },
590
+ {13 , "R5_w =pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))" },
591
591
/* New unknown value in R7 is (4n), >= 76 */
592
- {15 , "R7 =inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))" },
592
+ {15 , "R7_w =inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))" },
593
593
/* Adding it to packet pointer gives nice bounds again */
594
- {16 , "R5 =pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))" },
594
+ {16 , "R5_w =pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))" },
595
595
/* At the time the word size load is performed from R5,
596
596
* its total fixed offset is NET_IP_ALIGN + reg->off (0)
597
597
* which is 2. Then the variable offset is (4n+2), so
0 commit comments