Commit 69f4e3a
bpf: verifier improvement in 32bit shift sign extension pattern
This patch improves the verifier to correctly compute bounds for sign
extension compiler pattern composed of left shift by 32bits followed by
a sign right shift by 32bits.
Pattern in the verifier was limitted to positive value bounds and would
reset bound computation for negative values.
New code allows both positive and negative values for sign extension
without compromising bound computation and verifier to pass.
This change is required by GCC which generate such pattern, and was
detected in the context of systemd, as described in the following GCC
bugzilla:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119731
Three new tests were added in verifier_subreg.c.
Signed-off-by: Cupertino Miranda <[email protected]>
Signed-off-by: Andrew Pinski <[email protected]>
Cc: David Faust <[email protected]>
Cc: Jose Marchesi <[email protected]>
Cc: Elena Zannoni <[email protected]>
Acked-by: Eduard Zingerman <[email protected]>1 parent fb42a92 commit 69f4e3a
File tree
2 files changed
+77
-11
lines changed- kernel/bpf
- tools/testing/selftests/bpf/progs
2 files changed
+77
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15304 | 15304 | | |
15305 | 15305 | | |
15306 | 15306 | | |
15307 | | - | |
15308 | | - | |
15309 | | - | |
15310 | | - | |
15311 | | - | |
| 15307 | + | |
| 15308 | + | |
| 15309 | + | |
| 15310 | + | |
| 15311 | + | |
15312 | 15312 | | |
15313 | | - | |
| 15313 | + | |
15314 | 15314 | | |
15315 | | - | |
15316 | | - | |
15317 | | - | |
15318 | | - | |
15319 | 15315 | | |
15320 | | - | |
| 15316 | + | |
| 15317 | + | |
15321 | 15318 | | |
| 15319 | + | |
15322 | 15320 | | |
15323 | 15321 | | |
15324 | 15322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
534 | 602 | | |
535 | 603 | | |
536 | 604 | | |
| |||
0 commit comments