Commit 1837b29
committed
[BOLT] Gadget scanner: fix LR to be safe in leaf functions without CFG
After a label in a function without CFG information, use a reasonably pessimistic estimation of register state (assume that any register that can be clobbered in this function was actually clobbered) instead of the most pessimistic "all registers are unsafe". This is the same estimation as used by the dataflow variant of the analysis when the preceding instruction is not known for sure. Without this, leaf functions without CFG information are likely to have false positive reports about non-protected return instructions, as 1) LR is unlikely to be signed and authenticated in a leaf function and 2) LR is likely to be used by a return instruction near the end of the function and 3) the register state is likely to be reset at least once during the linear scan through the function1 parent e14dce9 commit 1837b29
File tree
5 files changed
+29
-93
lines changed- bolt
- lib/Passes
- test/binary-analysis/AArch64
5 files changed
+29
-93
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
740 | | - | |
741 | | - | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
742 | 743 | | |
743 | 744 | | |
744 | 745 | | |
745 | 746 | | |
746 | 747 | | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | 748 | | |
754 | 749 | | |
755 | 750 | | |
| |||
759 | 754 | | |
760 | 755 | | |
761 | 756 | | |
| 757 | + | |
762 | 758 | | |
763 | 759 | | |
764 | 760 | | |
| |||
773 | 769 | | |
774 | 770 | | |
775 | 771 | | |
776 | | - | |
| 772 | + | |
777 | 773 | | |
778 | 774 | | |
779 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
238 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
239 | 252 | | |
240 | | - | |
| 253 | + | |
241 | 254 | | |
242 | 255 | | |
243 | 256 | | |
| |||
Lines changed: 0 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | 494 | | |
499 | 495 | | |
500 | 496 | | |
| |||
541 | 537 | | |
542 | 538 | | |
543 | 539 | | |
544 | | - | |
545 | 540 | | |
546 | 541 | | |
547 | 542 | | |
548 | 543 | | |
549 | 544 | | |
550 | 545 | | |
551 | | - | |
552 | 546 | | |
553 | 547 | | |
554 | 548 | | |
555 | 549 | | |
556 | 550 | | |
557 | 551 | | |
558 | 552 | | |
559 | | - | |
560 | 553 | | |
561 | 554 | | |
562 | 555 | | |
563 | 556 | | |
564 | 557 | | |
565 | 558 | | |
566 | | - | |
567 | 559 | | |
568 | 560 | | |
569 | 561 | | |
| |||
575 | 567 | | |
576 | 568 | | |
577 | 569 | | |
578 | | - | |
579 | 570 | | |
580 | 571 | | |
581 | 572 | | |
582 | 573 | | |
583 | 574 | | |
584 | | - | |
585 | 575 | | |
586 | 576 | | |
587 | 577 | | |
| |||
615 | 605 | | |
616 | 606 | | |
617 | 607 | | |
618 | | - | |
619 | 608 | | |
620 | 609 | | |
621 | 610 | | |
622 | 611 | | |
623 | 612 | | |
624 | 613 | | |
625 | 614 | | |
626 | | - | |
627 | 615 | | |
628 | 616 | | |
629 | 617 | | |
| |||
634 | 622 | | |
635 | 623 | | |
636 | 624 | | |
637 | | - | |
638 | 625 | | |
639 | 626 | | |
640 | 627 | | |
641 | 628 | | |
642 | 629 | | |
643 | 630 | | |
644 | 631 | | |
645 | | - | |
646 | 632 | | |
647 | 633 | | |
648 | 634 | | |
| |||
653 | 639 | | |
654 | 640 | | |
655 | 641 | | |
656 | | - | |
657 | 642 | | |
658 | 643 | | |
659 | 644 | | |
660 | 645 | | |
661 | 646 | | |
662 | 647 | | |
663 | 648 | | |
664 | | - | |
665 | 649 | | |
666 | 650 | | |
667 | 651 | | |
668 | 652 | | |
669 | 653 | | |
670 | 654 | | |
671 | 655 | | |
672 | | - | |
673 | 656 | | |
674 | 657 | | |
675 | 658 | | |
676 | 659 | | |
677 | 660 | | |
678 | 661 | | |
679 | | - | |
680 | 662 | | |
681 | 663 | | |
682 | 664 | | |
683 | 665 | | |
684 | 666 | | |
685 | 667 | | |
686 | 668 | | |
687 | | - | |
688 | 669 | | |
689 | 670 | | |
690 | 671 | | |
| |||
698 | 679 | | |
699 | 680 | | |
700 | 681 | | |
701 | | - | |
702 | 682 | | |
703 | 683 | | |
704 | 684 | | |
| |||
Lines changed: 2 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
| 202 | + | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | 227 | | |
254 | 228 | | |
255 | 229 | | |
| |||
0 commit comments