]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/arm: check TGE and E2H flags for EL0 pauth traps
authorAlex Bennée <alex.bennee@linaro.org>
Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Feb 2020 14:04:26 +0000 (14:04 +0000)
According to ARM ARM we should only trap from the EL1&0 regime.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-35-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/pauth_helper.c

index e0c401c4a9e67b406189d336f5e16f9f5b05404e..9746e32bf817f2ab89732d113ab25733087acbfd 100644 (file)
@@ -371,7 +371,10 @@ static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
     if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
         uint64_t hcr = arm_hcr_el2_eff(env);
         bool trap = !(hcr & HCR_API);
-        /* FIXME: ARMv8.1-VHE: trap only applies to EL1&0 regime.  */
+        if (el == 0) {
+            /* Trap only applies to EL1&0 regime.  */
+            trap &= (hcr & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE);
+        }
         /* FIXME: ARMv8.3-NV: HCR_NV trap takes precedence for ERETA[AB].  */
         if (trap) {
             pauth_trap(env, 2, ra);