@@ -223,10 +223,37 @@ bad_unknown_usage_update:
223
223
ret
224
224
.size bad_unknown_usage_update , . - bad_unknown_usage_update
225
225
226
+ .globl good_overwrite_with_constant
227
+ .type good_overwrite_with_constant , @function
228
+ good_overwrite_with_constant:
229
+ // CHECK - NOT : good_overwrite_with_constant
230
+ autia x0 , x1
231
+ mov x0 , # 42
232
+ ret
233
+ .size good_overwrite_with_constant , . - good_overwrite_with_constant
234
+
235
+ // Overwriting sensitive data by instructions with unmodelled side - effects is
236
+ // explicitly rejected , even though this particular MRS is safe.
237
+ .globl bad_overwrite_with_side_effects
238
+ .type bad_overwrite_with_side_effects , @function
239
+ bad_overwrite_with_side_effects:
240
+ // CHECK - LABEL: GS - PAUTH: authentication oracle found in function bad_overwrite_with_side_effects , basic block {{ [ ^ ,]+ }} , at address
241
+ // CHECK - NEXT: The instruction is {{ [ 0 - 9a - f ]+ }}: autia x0 , x1
242
+ // CHECK - NEXT: The 0 instructions th at leak the affected registers are:
243
+ autia x0 , x1
244
+ mrs x0 , CTR_EL0
245
+ ret
246
+ .size bad_overwrite_with_side_effects , . - bad_overwrite_with_side_effects
247
+
248
+ // Here the new value written by MUL to x0 is completely unrelated to the result
249
+ // of authentication , so this is a false positive.
250
+ // FIXME: Can/should we generalize overwriting by constant to handle such cases?
226
251
.globl good_unknown_overwrite
227
252
.type good_unknown_overwrite , @function
228
253
good_unknown_overwrite:
229
- // CHECK - NOT : good_unknown_overwrite
254
+ // CHECK - LABEL: GS - PAUTH: authentication oracle found in function good_unknown_overwrite , basic block {{ [ ^ ,]+ }} , at address
255
+ // CHECK - NEXT: The instruction is {{ [ 0 - 9a - f ]+ }}: autia x0 , x1
256
+ // CHECK - NEXT: The 0 instructions th at leak the affected registers are:
230
257
autia x0 , x1
231
258
mul x0 , x1 , x2
232
259
ret
@@ -235,15 +262,15 @@ good_unknown_overwrite:
235
262
// This is a false positive: when a general - purpose register is written to as
236
263
// a 32 - bit register , its top 32 bits are zeroed , but according to LLVM
237
264
// representation , the instruction only overwrites the Wn register.
238
- .globl good_unknown_wreg_overwrite
239
- .type good_unknown_wreg_overwrite , @function
240
- good_unknown_wreg_overwrite :
241
- // CHECK - LABEL: GS - PAUTH: authentication oracle found in function good_unknown_wreg_overwrite , basic block {{ [ ^ ,]+ }} , at address
265
+ .globl good_wreg_overwrite
266
+ .type good_wreg_overwrite , @function
267
+ good_wreg_overwrite :
268
+ // CHECK - LABEL: GS - PAUTH: authentication oracle found in function good_wreg_overwrite , basic block {{ [ ^ ,]+ }} , at address
242
269
// CHECK - NEXT: The instruction is {{ [ 0 - 9a - f ]+ }}: autia x0 , x1
243
270
autia x0 , x1
244
- mul w0 , w1 , w2
271
+ mov w0 , # 42
245
272
ret
246
- .size good_unknown_wreg_overwrite , . - good_unknown_wreg_overwrite
273
+ .size good_wreg_overwrite , . - good_wreg_overwrite
247
274
248
275
.globl good_address_arith
249
276
.type good_address_arith , @function
@@ -435,16 +462,16 @@ bad_unknown_usage_update_multi_bb:
435
462
ret
436
463
.size bad_unknown_usage_update_multi_bb , . - bad_unknown_usage_update_multi_bb
437
464
438
- .globl good_unknown_overwrite_multi_bb
439
- .type good_unknown_overwrite_multi_bb , @function
440
- good_unknown_overwrite_multi_bb :
441
- // CHECK - NOT : good_unknown_overwrite_multi_bb
465
+ .globl good_overwrite_with_constant_multi_bb
466
+ .type good_overwrite_with_constant_multi_bb , @function
467
+ good_overwrite_with_constant_multi_bb :
468
+ // CHECK - NOT : good_overwrite_with_constant_multi_bb
442
469
autia x0 , x1
443
470
cbz x3 , 1f
444
471
1 :
445
- mul x0 , x1 , x2
472
+ mov x0 , # 42
446
473
ret
447
- .size good_unknown_overwrite_multi_bb , . - good_unknown_overwrite_multi_bb
474
+ .size good_overwrite_with_constant_multi_bb , . - good_overwrite_with_constant_multi_bb
448
475
449
476
.globl good_address_arith_multi_bb
450
477
.type good_address_arith_multi_bb , @function
@@ -638,20 +665,20 @@ bad_unknown_usage_update_nocfg:
638
665
ret
639
666
.size bad_unknown_usage_update_nocfg , . - bad_unknown_usage_update_nocfg
640
667
641
- .globl good_unknown_overwrite_nocfg
642
- .type good_unknown_overwrite_nocfg , @function
643
- good_unknown_overwrite_nocfg :
644
- // CHECK - NOT : good_unknown_overwrite_nocfg
668
+ .globl good_overwrite_with_constant_nocfg
669
+ .type good_overwrite_with_constant_nocfg , @function
670
+ good_overwrite_with_constant_nocfg :
671
+ // CHECK - NOT : good_overwrite_with_constant_nocfg
645
672
paciasp
646
673
adr x2 , 1f
647
674
br x2
648
675
1 :
649
676
autia x0 , x1
650
- mul x0 , x1 , x2
677
+ mov x0 , # 42
651
678
652
679
autiasp
653
680
ret
654
- .size good_unknown_overwrite_nocfg , . - good_unknown_overwrite_nocfg
681
+ .size good_overwrite_with_constant_nocfg , . - good_overwrite_with_constant_nocfg
655
682
656
683
.globl good_address_arith_nocfg
657
684
.type good_address_arith_nocfg , @function
0 commit comments