@@ -137,11 +137,56 @@ bad_unknown_usage_read:
137
137
// CHECK - NEXT: {{ [ 0 - 9a - f ]+ }}: ldr x2 , [ x0 ]
138
138
// CHECK - NEXT: {{ [ 0 - 9a - f ]+ }}: ret
139
139
autia x0 , x1
140
+ // Registers are not accessible to an attacker under Pointer
141
+ // Authentication thre at model , until spilled to memory.
142
+ // Thus , reporting the below MUL instruction is a false positive , since
143
+ // the next LDR instruction prevents any possible spilling of x3 unless
144
+ // the authentication succeeded. Though , rejecting anything except for
145
+ // a closed list of instruction types is the intended behavior of the
146
+ // analysis , so this false positive is by design.
140
147
mul x3 , x0 , x1
141
148
ldr x2 , [ x0 ]
142
149
ret
143
150
.size bad_unknown_usage_read , . - bad_unknown_usage_read
144
151
152
+ .globl bad_store_to_memory_and_wait
153
+ .type bad_store_to_memory_and_wait , @function
154
+ bad_store_to_memory_and_wait:
155
+ // CHECK - LABEL: GS - PAUTH: authentication oracle found in function bad_store_to_memory_and_wait , basic block {{ [ ^ ,]+ }} , at address
156
+ // CHECK - NEXT: The instruction is {{ [ 0 - 9a - f ]+ }}: autia x0 , x1
157
+ // CHECK - NEXT: The 1 instructions th at leak the affected registers are:
158
+ // CHECK - NEXT: 1 . {{ [ 0 - 9a - f ]+ }}: str x0 , [ x3 ]
159
+ autia x0 , x1
160
+ cbz x3 , 2f
161
+ str x0 , [ x3 ]
162
+ 1 :
163
+ // The thread performs a time - consuming computation while the result of
164
+ // authentication is accessible in memory.
165
+ nop
166
+ 2 :
167
+ ldr x2 , [ x0 ]
168
+ ret
169
+ .size bad_store_to_memory_and_wait , . - bad_store_to_memory_and_wait
170
+
171
+ // FIXME: Known false negative: if no return instruction is reachable from a
172
+ // program point (this probably implies an infinite loop ) , such
173
+ // instruction cannot be detected as an authentication oracle.
174
+ .globl bad_store_to_memory_and_hang
175
+ .type bad_store_to_memory_and_hang , @function
176
+ bad_store_to_memory_and_hang:
177
+ // CHECK - NOT : bad_store_to_memory_and_hang
178
+ autia x0 , x1
179
+ cbz x3 , 2f
180
+ str x0 , [ x3 ]
181
+ 1 :
182
+ // The thread loops indefinitely while the result of authentication
183
+ // is accessible in memory.
184
+ b 1b
185
+ 2 :
186
+ ldr x2 , [ x0 ]
187
+ ret
188
+ .size bad_store_to_memory_and_hang , . - bad_store_to_memory_and_hang
189
+
145
190
.globl bad_unknown_usage_subreg_read
146
191
.type bad_unknown_usage_subreg_read , @function
147
192
bad_unknown_usage_subreg_read:
@@ -419,6 +464,10 @@ good_address_arith_multi_bb:
419
464
ret
420
465
.size good_address_arith_multi_bb , . - good_address_arith_multi_bb
421
466
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
+
422
471
.globl good_ret_nocfg
423
472
.type good_ret_nocfg , @function
424
473
good_ret_nocfg:
@@ -454,13 +503,10 @@ good_call_nocfg:
454
503
.type good_branch_nocfg , @function
455
504
good_branch_nocfg:
456
505
// CHECK - NOT : good_branch_nocfg
457
- paciasp
458
506
adr x2 , 1f
459
507
br x2
460
508
1 :
461
509
autia x0 , x1
462
- autiasp // authenticate LR before tail call
463
- ldr x2 , [ x30 ] // check LR before tail call
464
510
br x0
465
511
.size good_branch_nocfg , . - good_branch_nocfg
466
512
0 commit comments