@@ -137,11 +137,56 @@ bad_unknown_usage_read:
137137// CHECK - NEXT: {{ [ 0 - 9a - f ]+ }}: ldr x2 , [ x0 ]
138138// CHECK - NEXT: {{ [ 0 - 9a - f ]+ }}: ret
139139 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.
140147 mul x3 , x0 , x1
141148 ldr x2 , [ x0 ]
142149 ret
143150 .size bad_unknown_usage_read , . - bad_unknown_usage_read
144151
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+
145190 .globl bad_unknown_usage_subreg_read
146191 .type bad_unknown_usage_subreg_read , @function
147192bad_unknown_usage_subreg_read:
@@ -419,6 +464,10 @@ good_address_arith_multi_bb:
419464 ret
420465 .size good_address_arith_multi_bb , . - good_address_arith_multi_bb
421466
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+
422471 .globl good_ret_nocfg
423472 .type good_ret_nocfg , @function
424473good_ret_nocfg:
@@ -454,13 +503,10 @@ good_call_nocfg:
454503 .type good_branch_nocfg , @function
455504good_branch_nocfg:
456505// CHECK - NOT : good_branch_nocfg
457- paciasp
458506 adr x2 , 1f
459507 br x2
4605081 :
461509 autia x0 , x1
462- autiasp // authenticate LR before tail call
463- ldr x2 , [ x30 ] // check LR before tail call
464510 br x0
465511 .size good_branch_nocfg , . - good_branch_nocfg
466512
0 commit comments