[PATCH] target/arm: Fix pauth_check_trap vs SEL2

Richard Henderson posted 1 patch 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220315021205.342768-1-richard.henderson@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/pauth_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] target/arm: Fix pauth_check_trap vs SEL2
Posted by Richard Henderson 2 years, 1 month ago
When arm_is_el2_enabled was introduced, we missed
updating pauth_check_trap.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/788
Fixes: e6ef0169264b ("target/arm: use arm_is_el2_enabled() where applicable")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/pauth_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
index cd6df18150..739aa520dd 100644
--- a/target/arm/pauth_helper.c
+++ b/target/arm/pauth_helper.c
@@ -390,7 +390,7 @@ static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,
 
 static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
 {
-    if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
+    if (el < 2 && arm_is_el2_enabled(env)) {
         uint64_t hcr = arm_hcr_el2_eff(env);
         bool trap = !(hcr & HCR_API);
         if (el == 0) {
-- 
2.25.1
Re: [PATCH] target/arm: Fix pauth_check_trap vs SEL2
Posted by Philippe Mathieu-Daudé 2 years, 1 month ago
Cc'ing Rémi

On 15/3/22 03:12, Richard Henderson wrote:
> When arm_is_el2_enabled was introduced, we missed
> updating pauth_check_trap.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/788
> Fixes: e6ef0169264b ("target/arm: use arm_is_el2_enabled() where applicable")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/pauth_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
> index cd6df18150..739aa520dd 100644
> --- a/target/arm/pauth_helper.c
> +++ b/target/arm/pauth_helper.c
> @@ -390,7 +390,7 @@ static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,
>   
>   static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
>   {
> -    if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
> +    if (el < 2 && arm_is_el2_enabled(env)) {
>           uint64_t hcr = arm_hcr_el2_eff(env);
>           bool trap = !(hcr & HCR_API);
>           if (el == 0) {

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Re: [PATCH] target/arm: Fix pauth_check_trap vs SEL2
Posted by Rémi Denis-Courmont 2 years, 1 month ago
Le tiistaina 15. maaliskuuta 2022, 4.12.05 EET Richard Henderson a écrit :
> When arm_is_el2_enabled was introduced, we missed
> updating pauth_check_trap.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/788
> Fixes: e6ef0169264b ("target/arm: use arm_is_el2_enabled() where
> applicable") Signed-off-by: Richard Henderson
> <richard.henderson@linaro.org>
> ---
>  target/arm/pauth_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
> index cd6df18150..739aa520dd 100644
> --- a/target/arm/pauth_helper.c
> +++ b/target/arm/pauth_helper.c
> @@ -390,7 +390,7 @@ static void QEMU_NORETURN pauth_trap(CPUARMState *env,
> int target_el,
> 
>  static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
>  {
> -    if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
> +    if (el < 2 && arm_is_el2_enabled(env)) {
>          uint64_t hcr = arm_hcr_el2_eff(env);
>          bool trap = !(hcr & HCR_API);
>          if (el == 0) {

Ack.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
Re: [PATCH] target/arm: Fix pauth_check_trap vs SEL2
Posted by Peter Maydell 2 years, 1 month ago
On Tue, 15 Mar 2022 at 02:12, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> When arm_is_el2_enabled was introduced, we missed
> updating pauth_check_trap.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/788
> Fixes: e6ef0169264b ("target/arm: use arm_is_el2_enabled() where applicable")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/arm/pauth_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)



Applied to target-arm.next, thanks.

-- PMM