aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Gilday <alexander.gilday@arm.com>2018-10-31 16:32:37 +0000
committerAlexander Gilday <alexander.gilday@arm.com>2018-11-05 15:42:59 +0000
commit0bdf5ed6e7b3b5e423e2ec3c81b02d7e0e949ba1 (patch)
tree7fa6ebcb135e4e98131857922ff1dce738fac2c0 /test
parent7560559a4efb32d9e51f12c5d17687a271f14d65 (diff)
Fix intermittent PAuth simulation failures.
This patch doesn't completely fix the tests however it significantly reduces the chances of a collision (from 1/127 to 1/127^32) and adds comments to explain the issue. Change-Id: I5861f8b6d0f1400d908348b6d14e05f5e7a4204e
Diffstat (limited to 'test')
-rw-r--r--test/aarch64/test-assembler-aarch64.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/aarch64/test-assembler-aarch64.cc b/test/aarch64/test-assembler-aarch64.cc
index 10f12911..6a7738be 100644
--- a/test/aarch64/test-assembler-aarch64.cc
+++ b/test/aarch64/test-assembler-aarch64.cc
@@ -2904,7 +2904,12 @@ TEST(return_to_reg_auth_fail) {
__ Retab();
__ Bind(&after_fn1);
- __ Bl(&fn1);
+ // There is a small but not negligible chance (1 in 127 runs) that the PAC
+ // codes for keys A and B will collide and RETAB won't abort. To mitigate
+ // this, we simply repeat the test a few more times.
+ for (unsigned i = 0; i < 32; i++) {
+ __ Bl(&fn1);
+ }
__ Mov(sp, x28);
__ Mov(lr, x29);
@@ -3543,9 +3548,14 @@ TEST(load_pauth_negative_test) {
START();
__ Mov(x16, src_base);
- __ Pacdza(x16);
-
- __ Ldrab(x0, MemOperand(x16));
+ // There is a small but not negligible chance (1 in 127 runs) that the PAC
+ // codes for keys A and B will collide and LDRAB won't abort. To mitigate
+ // this, we simply repeat the test a few more times.
+ for (unsigned i = 0; i < 32; i++) {
+ __ Add(x17, x16, i);
+ __ Pacdza(x17);
+ __ Ldrab(x0, MemOperand(x17));
+ }
END();
MUST_FAIL_WITH_MESSAGE(RUN(), "Failed to authenticate pointer.");