Skip to contentSkip to conversation

target/arm: Fix output of PAuth Auth

PATCH Applied Richard Henderson 2 participants 2 messages Jun 9, 2019 – Jun 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: Fix output of PAuth Auth

The ARM pseudocode installs the error_code into the original pointer, not the encrypted pointer. The difference applies within the 7 bits of pac data; the result should be the sign extension of bit 55.

Add a testcase to that effect.

---
 target/arm/pauth_helper.c         |  4 +-
 tests/tcg/aarch64/pauth-2.c       | 61 +++++++++++++++++++++++++++++++
 tests/tcg/aarch64/Makefile.target |  2 +-
 3 files changed, 64 insertions(+), 3 deletions(-)
 create mode 100644 tests/tcg/aarch64/pauth-2.c
target/arm/pauth_helper.c +2 -2
index 7f30ae7395..d3194f2043 100644
@@ -344,9 +344,9 @@ static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
     if (unlikely(extract64(test, bot_bit, top_bit - bot_bit))) {
         int error_code = (keynumber << 1) | (keynumber ^ 1);
         if (param.tbi) {
-            return deposit64(ptr, 53, 2, error_code);
+            return deposit64(orig_ptr, 53, 2, error_code);
         } else {
-            return deposit64(ptr, 61, 2, error_code);
+            return deposit64(orig_ptr, 61, 2, error_code);
         }
     }
     return orig_ptr;
tests/tcg/aarch64/pauth-2.c new file +61 -0

61 lines not on this page · raw message

tests/tcg/aarch64/Makefile.target +1 -1
index 2bb914975b..31ba9cfcaa 100644
@@ -15,7 +15,7 @@ run-fcvt: fcvt
 	$(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
 	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
 
-AARCH64_TESTS += pauth-1
+AARCH64_TESTS += pauth-1 pauth-2
 run-pauth-%: QEMU += -cpu max
 
 TESTS:=$(AARCH64_TESTS)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Richard Henderson

The ARM pseudocode installs the error_code into the original pointer, not the encrypted pointer. The difference applies within the 7 bits of pac data; the result should be the sign extension of bit 55.

Add a testcase to that effect.

---

Applied to target-arm.next, thanks.

-- PMM