Skip to content

Commit d6dbce8

Browse files
fomichevborkmann
authored andcommitted
selftests/bpf: fix test_align liveliness expectations
Commit 2589726 ("bpf: introduce bounded loops") caused a change in the way some registers liveliness is reported in the test_align. Add missing "_w" to a couple of tests. Note, there are no offset changes! Fixes: 2589726 ("bpf: introduce bounded loops") Signed-off-by: Stanislav Fomichev <[email protected]> Acked-by: Yonghong Song <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 46dd3d7 commit d6dbce8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/testing/selftests/bpf/test_align.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static struct bpf_align_test tests[] = {
180180
},
181181
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
182182
.matches = {
183-
{7, "R0=pkt(id=0,off=8,r=8,imm=0)"},
183+
{7, "R0_w=pkt(id=0,off=8,r=8,imm=0)"},
184184
{7, "R3_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
185185
{8, "R3_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
186186
{9, "R3_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
@@ -315,7 +315,7 @@ static struct bpf_align_test tests[] = {
315315
/* Calculated offset in R6 has unknown value, but known
316316
* alignment of 4.
317317
*/
318-
{8, "R2=pkt(id=0,off=0,r=8,imm=0)"},
318+
{8, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
319319
{8, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
320320
/* Offset is added to packet pointer R5, resulting in
321321
* known fixed offset, and variable offset from R6.
@@ -405,7 +405,7 @@ static struct bpf_align_test tests[] = {
405405
/* Calculated offset in R6 has unknown value, but known
406406
* alignment of 4.
407407
*/
408-
{8, "R2=pkt(id=0,off=0,r=8,imm=0)"},
408+
{8, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
409409
{8, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
410410
/* Adding 14 makes R6 be (4n+2) */
411411
{9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
@@ -473,20 +473,20 @@ static struct bpf_align_test tests[] = {
473473
/* (4n) + 14 == (4n+2). We blow our bounds, because
474474
* the add could overflow.
475475
*/
476-
{7, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"},
476+
{7, "R5_w=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"},
477477
/* Checked s>=0 */
478478
{9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
479479
/* packet pointer + nonnegative (4n+2) */
480480
{11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
481-
{13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
481+
{13, "R4_w=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
482482
/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine.
483483
* We checked the bounds, but it might have been able
484484
* to overflow if the packet pointer started in the
485485
* upper half of the address space.
486486
* So we did not get a 'range' on R6, and the access
487487
* attempt will fail.
488488
*/
489-
{15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
489+
{15, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},
490490
}
491491
},
492492
{
@@ -521,7 +521,7 @@ static struct bpf_align_test tests[] = {
521521
/* Calculated offset in R6 has unknown value, but known
522522
* alignment of 4.
523523
*/
524-
{7, "R2=pkt(id=0,off=0,r=8,imm=0)"},
524+
{7, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
525525
{9, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
526526
/* Adding 14 makes R6 be (4n+2) */
527527
{10, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
@@ -574,7 +574,7 @@ static struct bpf_align_test tests[] = {
574574
/* Calculated offset in R6 has unknown value, but known
575575
* alignment of 4.
576576
*/
577-
{7, "R2=pkt(id=0,off=0,r=8,imm=0)"},
577+
{7, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
578578
{10, "R6_w=inv(id=0,umax_value=60,var_off=(0x0; 0x3c))"},
579579
/* Adding 14 makes R6 be (4n+2) */
580580
{11, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},

0 commit comments

Comments
 (0)