target/arm: Fix output of PAuth Auth
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.
Signed-off-by Richard Henderson <[email protected]>
--- 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
@@ -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
@@ -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
Peter Maydell
AppliedQuoted 10 lines · Richard Henderson
The ARM pseudocode installs the
error_codeinto 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.
Signed-off-by Richard Henderson <[email protected]>---
Applied to target-arm.next, thanks.
-- PMM