|
| 1 | +//@ add-minicore |
1 | 2 | // ignore-tidy-linelength |
2 | 3 | //@ only-pauthtest |
3 | | -//@ revisions: DEFAULT ALL DISABLE_JUMP DISABLE_AUTH_TRAPS DISABLE_CALLS DISABLE_INDIRCT_GOTOS DISABLE_RETURNS DISABLE_INTRINSICS DISABLE_TYPEINFO DISABLE_VT_PTR_ADDR DISABLE_VT_PTR_TYPE NONE |
| 4 | +//@ revisions: DEFAULT ALL DISABLE_JUMP DISABLE_AUTH_TRAPS DISABLE_CALLS DISABLE_INDIRECT_GOTOS DISABLE_RETURNS DISABLE_INTRINSICS DISABLE_TYPEINFO DISABLE_VT_PTR_ADDR DISABLE_VT_PTR_TYPE NONE AARCH64_MUSL |
| 5 | + |
| 6 | +#![feature(no_core, lang_items)] |
| 7 | +#![no_std] |
| 8 | +#![no_core] |
| 9 | +#![crate_type = "lib"] |
| 10 | + |
| 11 | +extern crate minicore; |
| 12 | +use minicore::ptr; |
4 | 13 |
|
5 | 14 | //@[DEFAULT] needs-llvm-components: aarch64 |
6 | 15 | //@[DEFAULT] compile-flags: --target=aarch64-unknown-linux-pauthtest |
|
12 | 21 | //@[DISABLE_AUTH_TRAPS] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-auth-traps |
13 | 22 | //@[DISABLE_CALLS] needs-llvm-components: aarch64 |
14 | 23 | //@[DISABLE_CALLS] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-calls |
15 | | -//@[DISABLE_INDIRCT_GOTOS] needs-llvm-components: aarch64 |
16 | | -//@[DISABLE_INDIRCT_GOTOS] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-indirect-gotos |
| 24 | +//@[DISABLE_INDIRECT_GOTOS] needs-llvm-components: aarch64 |
| 25 | +//@[DISABLE_INDIRECT_GOTOS] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-indirect-gotos |
17 | 26 | //@[DISABLE_RETURNS] needs-llvm-components: aarch64 |
18 | 27 | //@[DISABLE_RETURNS] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-return-addresses |
19 | 28 | //@[DISABLE_INTRINSICS] needs-llvm-components: aarch64 |
|
25 | 34 | //@[DISABLE_VT_PTR_TYPE] needs-llvm-components: aarch64 |
26 | 35 | //@[DISABLE_VT_PTR_TYPE] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-vt-ptr-type-discrimination |
27 | 36 | //@[NONE] needs-llvm-components: aarch64 |
28 | | -//@[NONE] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-aarch64-jump-table-hardening,-auth-traps,-calls,-indirect-gotos,-return-addresses,-init-fini,-init-fini-address-discrimination,-intrinsics,-typeinfo-vt-ptr-discrimination,-vt-ptr-addr-discrimination,-vt-ptr-type-discrimination |
| 37 | +//@[NONE] compile-flags: --target=aarch64-unknown-linux-pauthtest -Zpointer-authentication=-aarch64-jump-table-hardening,-auth-traps,-calls,-indirect-gotos,-return-addresses,-init-fini,-init-fini-address-discrimination,-intrinsics,-typeinfo-vt-ptr-discrimination,-vt-ptr-addr-discrimination,-vt-ptr-type-discrimination |
| 38 | +//@[AARCH64_MUSL] needs-llvm-components: aarch64 |
| 39 | +//@[AARCH64_MUSL] compile-flags: --target=aarch64-unknown-linux-musl |
29 | 40 |
|
30 | | -// CHECK: define {{.*}} @main{{.*}} [[ATTR_MAIN:#[0-9]+]] |
31 | | -fn main() {} |
| 41 | +// CHECK: define {{.*}} @{{.*}}test{{.*}} [[ATTR_MAIN:#[0-9]+]] |
| 42 | +#[inline(never)] |
| 43 | +pub fn test(a: i32) -> i32 { |
| 44 | + a + 4 |
| 45 | +} |
32 | 46 | // DEFAULT: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
33 | 47 | // DEFAULT-SAME: "ptrauth-auth-traps" |
34 | 48 | // DEFAULT-SAME: "ptrauth-calls" |
35 | 49 | // DEFAULT-SAME: "ptrauth-indirect-gotos" |
36 | 50 | // DEFAULT-SAME: "ptrauth-returns" |
37 | | -// DEFAULT: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
38 | | -// DEFAULT-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1791} |
| 51 | +// DEFAULT: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 52 | +// DEFAULT-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1791} |
39 | 53 |
|
40 | 54 | // DISABLE_JUMP-NOT: aarch64-jump-table-hardening |
41 | 55 | // DISABLE_JUMP: attributes [[ATTR_MAIN]] = { {{.*}}"ptrauth-auth-traps" |
42 | 56 | // DISABLE_JUMP-SAME: "ptrauth-calls" |
43 | 57 | // DISABLE_JUMP-SAME: "ptrauth-indirect-gotos" |
44 | 58 | // DISABLE_JUMP-SAME: "ptrauth-returns" |
45 | | -// DISABLE_JUMP: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
46 | | -// DISABLE_JUMP-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1791} |
| 59 | +// DISABLE_JUMP: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 60 | +// DISABLE_JUMP-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1791} |
47 | 61 |
|
48 | 62 | // DISABLE_AUTH_TRAPS-NOT: ptrauth-auth-traps |
49 | 63 | // DISABLE_AUTH_TRAPS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
50 | 64 | // DISABLE_AUTH_TRAPS-SAME: "ptrauth-calls" |
51 | 65 | // DISABLE_AUTH_TRAPS-SAME: "ptrauth-indirect-gotos" |
52 | 66 | // DISABLE_AUTH_TRAPS-SAME: "ptrauth-returns" |
53 | | -// DISABLE_AUTH_TRAPS: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
54 | | -// DISABLE_AUTH_TRAPS-NEXT !{i32 1, !"aarch64-elf-pauthabi-version", i32 1783} |
| 67 | +// DISABLE_AUTH_TRAPS: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 68 | +// DISABLE_AUTH_TRAPS-NEXT !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1783} |
55 | 69 |
|
56 | 70 | // DISABLE_CALLS-NOT: ptrauth-calls |
57 | 71 | // DISABLE_CALLS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
58 | 72 | // DISABLE_CALLS-SAME: "ptrauth-auth-traps" |
59 | 73 | // DISABLE_CALLS-SAME: "ptrauth-indirect-gotos" |
60 | 74 | // DISABLE_CALLS-SAME: "ptrauth-returns" |
61 | | -// DISABLE_CALLS: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
62 | | -// DISABLE_CALLS-SAME-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1789} |
| 75 | +// DISABLE_CALLS: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 76 | +// DISABLE_CALLS-SAME-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1789} |
63 | 77 |
|
64 | | -// DISABLE_INDIRCT_GOTOS-NOT: ptrauth-indirect-gotos |
65 | | -// DISABLE_INDIRCT_GOTOS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
66 | | -// DISABLE_INDIRCT_GOTOS-SAME: "ptrauth-auth-traps" |
67 | | -// DISABLE_INDIRCT_GOTOS-SAME: "ptrauth-calls" |
68 | | -// DISABLE_INDIRCT_GOTOS-SAME: "ptrauth-returns" |
69 | | -// DISABLE_INDIRCT_GOTOS: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1279} |
70 | | -// DISABLE_INDIRCT_GOTOS-NEXT: !{i32 1, !"ptrauth-sign-personality", i32 1} |
| 78 | +// DISABLE_INDIRECT_GOTOS-NOT: ptrauth-indirect-gotos |
| 79 | +// DISABLE_INDIRECT_GOTOS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
| 80 | +// DISABLE_INDIRECT_GOTOS-SAME: "ptrauth-auth-traps" |
| 81 | +// DISABLE_INDIRECT_GOTOS-SAME: "ptrauth-calls" |
| 82 | +// DISABLE_INDIRECT_GOTOS-SAME: "ptrauth-returns" |
| 83 | +// DISABLE_INDIRECT_GOTOS: !{i32 [[#]], !"ptrauth-elf-got", i32 0} |
| 84 | +// DISABLE_INDIRECT_GOTOS-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 85 | +// DISABLE_INDIRECT_GOTOS-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1279} |
| 86 | +// DISABLE_INDIRECT_GOTOS-NEXT: !{i32 [[#]], !"ptrauth-sign-personality", i32 1} |
71 | 87 |
|
72 | 88 | // DISABLE_RETURNS-NOT: ptrauth-returns |
73 | 89 | // DISABLE_RETURNS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
74 | 90 | // DISABLE_RETURNS-SAME: "ptrauth-auth-traps" |
75 | 91 | // DISABLE_RETURNS-SAME: "ptrauth-calls" |
76 | 92 | // DISABLE_RETURNS-SAME: "ptrauth-indirect-gotos" |
77 | | -// DISABLE_RETURNS: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
78 | | -// DISABLE_RETURNS-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1787} |
| 93 | +// DISABLE_RETURNS: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 94 | +// DISABLE_RETURNS-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1787} |
79 | 95 |
|
80 | 96 | // DISABLE_INTRINSICS: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
81 | 97 | // DISABLE_INTRINSICS-SAME: "ptrauth-auth-traps" |
82 | 98 | // DISABLE_INTRINSICS-SAME: "ptrauth-calls" |
83 | 99 | // DISABLE_INTRINSICS-SAME: "ptrauth-indirect-gotos" |
84 | 100 | // DISABLE_INTRINSICS-SAME: "ptrauth-returns" |
85 | | -// DISABLE_INTRINSICS: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
86 | | -// DISABLE_INTRINSICS-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1790} |
| 101 | +// DISABLE_INTRINSICS: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 102 | +// DISABLE_INTRINSICS-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1790} |
87 | 103 |
|
88 | 104 | // DISABLE_TYPEINFO: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
89 | 105 | // DISABLE_TYPEINFO-SAME: "ptrauth-auth-traps" |
90 | 106 | // DISABLE_TYPEINFO-SAME: "ptrauth-calls" |
91 | 107 | // DISABLE_TYPEINFO-SAME: "ptrauth-indirect-gotos" |
92 | 108 | // DISABLE_TYPEINFO-SAME: "ptrauth-returns" |
93 | | -// DISABLE_TYPEINFO: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
94 | | -// DISABLE_TYPEINFO-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 767} |
| 109 | +// DISABLE_TYPEINFO: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 110 | +// DISABLE_TYPEINFO-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 767} |
95 | 111 |
|
96 | 112 | // DISABLE_VT_PTR_ADDR: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
97 | 113 | // DISABLE_VT_PTR_ADDR-SAME: "ptrauth-auth-traps" |
98 | 114 | // DISABLE_VT_PTR_ADDR-SAME: "ptrauth-calls" |
99 | 115 | // DISABLE_VT_PTR_ADDR-SAME: "ptrauth-indirect-gotos" |
100 | 116 | // DISABLE_VT_PTR_ADDR-SAME: "ptrauth-returns" |
101 | | -// DISABLE_VT_PTR_ADDR: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
102 | | -// DISABLE_VT_PTR_ADDR-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1775} |
| 117 | +// DISABLE_VT_PTR_ADDR: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 118 | +// DISABLE_VT_PTR_ADDR-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1775} |
103 | 119 |
|
104 | 120 | // DISABLE_VT_PTR_TYPE: attributes [[ATTR_MAIN]] = { {{.*}}"aarch64-jump-table-hardening" |
105 | 121 | // DISABLE_VT_PTR_TYPE-SAME: "ptrauth-auth-traps" |
106 | 122 | // DISABLE_VT_PTR_TYPE-SAME: "ptrauth-calls" |
107 | 123 | // DISABLE_VT_PTR_TYPE-SAME: "ptrauth-indirect-gotos" |
108 | 124 | // DISABLE_VT_PTR_TYPE-SAME: "ptrauth-returns" |
109 | | -// DISABLE_VT_PTR_TYPE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} |
110 | | -// DISABLE_VT_PTR_TYPE-NEXT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1759} |
| 125 | +// DISABLE_VT_PTR_TYPE: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 126 | +// DISABLE_VT_PTR_TYPE-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 1759} |
111 | 127 |
|
112 | 128 | // NONE-NOT: ptrauth-returns |
113 | 129 | // NONE-NOT: aarch64-jump-table-hardening |
114 | 130 | // NONE-NOT: ptrauth-auth-traps |
115 | 131 | // NONE-NOT: ptrauth-calls |
116 | 132 | // NONE-NOT: ptrauth-indirect-gotos |
117 | | -// NONE-NOT: aarch64-elf-pauthabi-platform |
118 | | -// NONE-NOT: aarch64-elf-pauthabi-version |
| 133 | +// The following flags are always emitted. When all ptrauth options are disabled, |
| 134 | +// their values should be 0. |
| 135 | +// NONE: !{i32 [[#]], !"ptrauth-elf-got", i32 0} |
| 136 | +// NONE-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 137 | +// NONE-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 0} |
| 138 | +// NONE-NEXT: !{i32 [[#]], !"ptrauth-sign-personality", i32 0} |
| 139 | + |
| 140 | +// AARCH64_MUSL: !{i32 [[#]], !"ptrauth-elf-got", i32 0} |
| 141 | +// AARCH64_MUSL-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-platform", i32 268435458} |
| 142 | +// AARCH64_MUSL-NEXT: !{i32 [[#]], !"aarch64-elf-pauthabi-version", i32 0} |
| 143 | +// AARCH64_MUSL-NEXT: !{i32 [[#]], !"ptrauth-sign-personality", i32 0} |
0 commit comments