Skip to content

Commit 630128c

Browse files
committed
Account for improved nocfg analysis: update the tests
1 parent 5a68042 commit 630128c

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

bolt/test/binary-analysis/AArch64/gs-pauth-authentication-oracles.s

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,6 @@ good_address_arith_multi_bb:
464464
ret
465465
.size good_address_arith_multi_bb, .-good_address_arith_multi_bb
466466

467-
// FIXME: Most *_nocfg test cases contain paciasp+autiasp instructions even if
468-
// LR is not spilled - this is a workaround for RET instructions being
469-
// reported as non-protected, because LR state is reset at every label.
470-
471467
.globl good_ret_nocfg
472468
.type good_ret_nocfg,@function
473469
good_ret_nocfg:
@@ -514,29 +510,25 @@ good_branch_nocfg:
514510
.type good_load_other_reg_nocfg,@function
515511
good_load_other_reg_nocfg:
516512
// CHECK-NOT: good_load_other_reg_nocfg
517-
paciasp
518513
adr x2, 1f
519514
br x2
520515
1:
521516
autia x0, x1
522517
ldr x2, [x0]
523518

524-
autiasp
525519
ret
526520
.size good_load_other_reg_nocfg, .-good_load_other_reg_nocfg
527521

528522
.globl good_load_same_reg_nocfg
529523
.type good_load_same_reg_nocfg,@function
530524
good_load_same_reg_nocfg:
531525
// CHECK-NOT: good_load_same_reg_nocfg
532-
paciasp
533526
adr x2, 1f
534527
br x2
535528
1:
536529
autia x0, x1
537530
ldr x0, [x0]
538531

539-
autiasp
540532
ret
541533
.size good_load_same_reg_nocfg, .-good_load_same_reg_nocfg
542534

@@ -548,13 +540,11 @@ bad_unchecked_nocfg:
548540
// CHECK-LABEL: GS-PAUTH: authentication oracle found in function bad_unchecked_nocfg, at address
549541
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: autia x0, x1
550542
// CHECK-NEXT: The 0 instructions that leak the affected registers are:
551-
paciasp
552543
adr x2, 1f
553544
br x2
554545
1:
555546
autia x0, x1
556547

557-
autiasp
558548
ret
559549
.size bad_unchecked_nocfg, .-bad_unchecked_nocfg
560550

@@ -588,15 +578,13 @@ bad_unknown_usage_read_nocfg:
588578
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: autia x0, x1
589579
// CHECK-NEXT: The 1 instructions that leak the affected registers are:
590580
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mul x3, x0, x1
591-
paciasp
592581
adr x2, 1f
593582
br x2
594583
1:
595584
autia x0, x1
596585
mul x3, x0, x1
597586
ldr x2, [x0]
598587

599-
autiasp
600588
ret
601589
.size bad_unknown_usage_read_nocfg, .-bad_unknown_usage_read_nocfg
602590

@@ -607,15 +595,13 @@ bad_unknown_usage_subreg_read_nocfg:
607595
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: autia x0, x1
608596
// CHECK-NEXT: The 1 instructions that leak the affected registers are:
609597
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mul w3, w0, w1
610-
paciasp
611598
adr x2, 1f
612599
br x2
613600
1:
614601
autia x0, x1
615602
mul w3, w0, w1
616603
ldr x2, [x0]
617604

618-
autiasp
619605
ret
620606
.size bad_unknown_usage_subreg_read_nocfg, .-bad_unknown_usage_subreg_read_nocfg
621607

@@ -626,38 +612,33 @@ bad_unknown_usage_update_nocfg:
626612
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: autia x0, x1
627613
// CHECK-NEXT: The 1 instructions that leak the affected registers are:
628614
// CHECK-NEXT: 1. {{[0-9a-f]+}}: movk x0, #0x2a, lsl #16
629-
paciasp
630615
adr x2, 1f
631616
br x2
632617
1:
633618
autia x0, x1
634619
movk x0, #42, lsl #16 // does not overwrite x0 completely
635620
ldr x2, [x0]
636621

637-
autiasp
638622
ret
639623
.size bad_unknown_usage_update_nocfg, .-bad_unknown_usage_update_nocfg
640624

641625
.globl good_unknown_overwrite_nocfg
642626
.type good_unknown_overwrite_nocfg,@function
643627
good_unknown_overwrite_nocfg:
644628
// CHECK-NOT: good_unknown_overwrite_nocfg
645-
paciasp
646629
adr x2, 1f
647630
br x2
648631
1:
649632
autia x0, x1
650633
mul x0, x1, x2
651634

652-
autiasp
653635
ret
654636
.size good_unknown_overwrite_nocfg, .-good_unknown_overwrite_nocfg
655637

656638
.globl good_address_arith_nocfg
657639
.type good_address_arith_nocfg,@function
658640
good_address_arith_nocfg:
659641
// CHECK-NOT: good_address_arith_nocfg
660-
paciasp
661642
adr x2, 1f
662643
br x2
663644
1:
@@ -671,7 +652,6 @@ good_address_arith_nocfg:
671652
mov x1, #0
672653
mov x2, #0
673654

674-
autiasp
675655
ret
676656
.size good_address_arith_nocfg, .-good_address_arith_nocfg
677657

bolt/test/binary-analysis/AArch64/gs-pauth-signing-oracles.s

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -505,36 +505,29 @@ bad_one_auted_one_checked_multi_bb:
505505
// * untrusted: not even s-t-d - from arg and from memory
506506
// * untrusted: subreg clobbered - between address materialization and use, between auth and check, between check and use
507507
// * untrusted: first checked then auted, auted then auted, checked then checked
508-
//
509-
// Note that it is important to sign and authenticate LR, as it is not kept
510-
// safe-to-dereference across unconditional branches.
511508

512509
.globl good_sign_addr_mat_nocfg
513510
.type good_sign_addr_mat_nocfg,@function
514511
good_sign_addr_mat_nocfg:
515512
// CHECK-NOT: good_sign_addr_mat_nocfg
516-
paciasp
517513
adr x3, 1f
518514
br x3
519515
1:
520516
adr x0, sym
521517
pacda x0, x1
522-
autiasp
523518
ret
524519
.size good_sign_addr_mat_nocfg, .-good_sign_addr_mat_nocfg
525520

526521
.globl good_sign_auted_checked_ldr_nocfg
527522
.type good_sign_auted_checked_ldr_nocfg,@function
528523
good_sign_auted_checked_ldr_nocfg:
529524
// CHECK-NOT: good_sign_auted_checked_ldr_nocfg
530-
paciasp
531525
adr x3, 1f
532526
br x3
533527
1:
534528
autda x0, x2
535529
ldr x2, [x0]
536530
pacda x0, x1
537-
autiasp
538531
ret
539532
.size good_sign_auted_checked_ldr_nocfg, .-good_sign_auted_checked_ldr_nocfg
540533

@@ -544,13 +537,11 @@ bad_sign_authed_unchecked_nocfg:
544537
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_sign_authed_unchecked_nocfg, at address
545538
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
546539
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
547-
paciasp
548540
adr x3, 1f
549541
br x3
550542
1:
551543
autda x0, x2
552544
pacda x0, x1
553-
autiasp
554545
ret
555546
.size bad_sign_authed_unchecked_nocfg, .-bad_sign_authed_unchecked_nocfg
556547

@@ -560,13 +551,11 @@ bad_sign_checked_not_auted_nocfg:
560551
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_sign_checked_not_auted_nocfg, at address
561552
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
562553
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
563-
paciasp
564554
adr x3, 1f
565555
br x3
566556
1:
567557
ldr x2, [x0]
568558
pacda x0, x1
569-
autiasp
570559
ret
571560
.size bad_sign_checked_not_auted_nocfg, .-bad_sign_checked_not_auted_nocfg
572561

@@ -576,12 +565,10 @@ bad_sign_plain_arg_nocfg:
576565
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_sign_plain_arg_nocfg, at address
577566
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
578567
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
579-
paciasp
580568
adr x3, 1f
581569
br x3
582570
1:
583571
pacda x0, x1
584-
autiasp
585572
ret
586573
.size bad_sign_plain_arg_nocfg, .-bad_sign_plain_arg_nocfg
587574

@@ -592,13 +579,11 @@ bad_sign_plain_mem_nocfg:
592579
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
593580
// CHECK-NEXT: The 1 instructions that write to the affected registers after any authentication are:
594581
// CHECK-NEXT: 1. {{[0-9a-f]+}}: ldr x0, [x1]
595-
paciasp
596582
adr x3, 1f
597583
br x3
598584
1:
599585
ldr x0, [x1]
600586
pacda x0, x1
601-
autiasp
602587
ret
603588
.size bad_sign_plain_mem_nocfg, .-bad_sign_plain_mem_nocfg
604589

@@ -609,14 +594,12 @@ bad_clobber_between_addr_mat_and_use_nocfg:
609594
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
610595
// CHECK-NEXT: The 1 instructions that write to the affected registers after any authentication are:
611596
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mov w0, w4
612-
paciasp
613597
adr x3, 1f
614598
br x3
615599
1:
616600
adr x0, sym
617601
mov w0, w4
618602
pacda x0, x1
619-
autiasp
620603
ret
621604
.size bad_clobber_between_addr_mat_and_use_nocfg, .-bad_clobber_between_addr_mat_and_use_nocfg
622605

@@ -627,15 +610,13 @@ bad_clobber_between_auted_and_checked_nocfg:
627610
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
628611
// CHECK-NEXT: The 1 instructions that write to the affected registers after any authentication are:
629612
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mov w0, w4
630-
paciasp
631613
adr x3, 1f
632614
br x3
633615
1:
634616
autda x0, x2
635617
mov w0, w4
636618
ldr x2, [x0]
637619
pacda x0, x1
638-
autiasp
639620
ret
640621
.size bad_clobber_between_auted_and_checked_nocfg, .-bad_clobber_between_auted_and_checked_nocfg
641622

@@ -646,15 +627,13 @@ bad_clobber_between_checked_and_used_nocfg:
646627
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
647628
// CHECK-NEXT: The 1 instructions that write to the affected registers after any authentication are:
648629
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mov w0, w4
649-
paciasp
650630
adr x3, 1f
651631
br x3
652632
1:
653633
autda x0, x2
654634
ldr x2, [x0]
655635
mov w0, w4
656636
pacda x0, x1
657-
autiasp
658637
ret
659638
.size bad_clobber_between_checked_and_used_nocfg, .-bad_clobber_between_checked_and_used_nocfg
660639

@@ -664,14 +643,12 @@ bad_transition_check_then_auth_nocfg:
664643
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_transition_check_then_auth_nocfg, at address
665644
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
666645
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
667-
paciasp
668646
adr x3, 1f
669647
br x3
670648
1:
671649
ldr x2, [x0]
672650
autda x0, x2
673651
pacda x0, x1
674-
autiasp
675652
ret
676653
.size bad_transition_check_then_auth_nocfg, .-bad_transition_check_then_auth_nocfg
677654

@@ -681,14 +658,12 @@ bad_transition_auth_then_auth_nocfg:
681658
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_transition_auth_then_auth_nocfg, at address
682659
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
683660
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
684-
paciasp
685661
adr x3, 1f
686662
br x3
687663
1:
688664
autda x0, x2
689665
autda x0, x2
690666
pacda x0, x1
691-
autiasp
692667
ret
693668
.size bad_transition_auth_then_auth_nocfg, .-bad_transition_auth_then_auth_nocfg
694669

@@ -698,14 +673,12 @@ bad_transition_check_then_check_nocfg:
698673
// CHECK-LABEL: GS-PAUTH: signing oracle found in function bad_transition_check_then_check_nocfg, at address
699674
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: pacda x0, x1
700675
// CHECK-NEXT: The 0 instructions that write to the affected registers after any authentication are:
701-
paciasp
702676
adr x3, 1f
703677
br x3
704678
1:
705679
ldr x2, [x0]
706680
ldr x2, [x0]
707681
pacda x0, x1
708-
autiasp
709682
ret
710683
.size bad_transition_check_then_check_nocfg, .-bad_transition_check_then_check_nocfg
711684

0 commit comments

Comments
 (0)