From 0bdf5ed6e7b3b5e423e2ec3c81b02d7e0e949ba1 Mon Sep 17 00:00:00 2001 From: Alexander Gilday Date: Wed, 31 Oct 2018 16:32:37 +0000 Subject: 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 --- test/aarch64/test-assembler-aarch64.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'test/aarch64') 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."); -- cgit v1.2.3