All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
@ 2018-03-09 15:40 Marc Zyngier
  2018-03-09 15:55 ` Ard Biesheuvel
  2018-03-09 17:52 ` Catalin Marinas
  0 siblings, 2 replies; 4+ messages in thread
From: Marc Zyngier @ 2018-03-09 15:40 UTC (permalink / raw)
  To: linux-arm-kernel

A recent update to the ARM SMCCC ARCH_WORKAROUND_1 specification
allows firmware to return a non zero, positive value to describe
that although the mitigation is implemented at the higher exception
level, the CPU on which the call is made is not affected.

Let's relax the check on the return value from ARCH_WORKAROUND_1
so that we only error out if the returned value is negative.

Fixes: b092201e0020 ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm64/kernel/cpu_errata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 07823595b7f0..91428426bf26 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -178,7 +178,7 @@ static int enable_smccc_arch_workaround_1(void *data)
 	case PSCI_CONDUIT_HVC:
 		arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
 				  ARM_SMCCC_ARCH_WORKAROUND_1, &res);
-		if (res.a0)
+		if ((int)res.a0 < 0)
 			return 0;
 		cb = call_hvc_arch_workaround_1;
 		smccc_start = __smccc_workaround_1_hvc_start;
@@ -188,7 +188,7 @@ static int enable_smccc_arch_workaround_1(void *data)
 	case PSCI_CONDUIT_SMC:
 		arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
 				  ARM_SMCCC_ARCH_WORKAROUND_1, &res);
-		if (res.a0)
+		if ((int)res.a0 < 0)
 			return 0;
 		cb = call_smc_arch_workaround_1;
 		smccc_start = __smccc_workaround_1_smc_start;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
  2018-03-09 15:40 [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery Marc Zyngier
@ 2018-03-09 15:55 ` Ard Biesheuvel
  2018-03-09 16:09   ` Marc Zyngier
  2018-03-09 17:52 ` Catalin Marinas
  1 sibling, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2018-03-09 15:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 9 March 2018 at 15:40, Marc Zyngier <marc.zyngier@arm.com> wrote:
> A recent update to the ARM SMCCC ARCH_WORKAROUND_1 specification
> allows firmware to return a non zero, positive value to describe
> that although the mitigation is implemented at the higher exception
> level, the CPU on which the call is made is not affected.
>
> Let's relax the check on the return value from ARCH_WORKAROUND_1
> so that we only error out if the returned value is negative.
>
> Fixes: b092201e0020 ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

OK, so this means the current code running on new firmware will
erroneously assume that the mitigation is not implemented or needed if
it, say, happens to run on the A53 cluster on Juno?

> ---
>  arch/arm64/kernel/cpu_errata.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 07823595b7f0..91428426bf26 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -178,7 +178,7 @@ static int enable_smccc_arch_workaround_1(void *data)
>         case PSCI_CONDUIT_HVC:
>                 arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
>                                   ARM_SMCCC_ARCH_WORKAROUND_1, &res);
> -               if (res.a0)
> +               if ((int)res.a0 < 0)
>                         return 0;
>                 cb = call_hvc_arch_workaround_1;
>                 smccc_start = __smccc_workaround_1_hvc_start;
> @@ -188,7 +188,7 @@ static int enable_smccc_arch_workaround_1(void *data)
>         case PSCI_CONDUIT_SMC:
>                 arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
>                                   ARM_SMCCC_ARCH_WORKAROUND_1, &res);
> -               if (res.a0)
> +               if ((int)res.a0 < 0)
>                         return 0;
>                 cb = call_smc_arch_workaround_1;
>                 smccc_start = __smccc_workaround_1_smc_start;
> --
> 2.14.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
  2018-03-09 15:55 ` Ard Biesheuvel
@ 2018-03-09 16:09   ` Marc Zyngier
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2018-03-09 16:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/03/18 15:55, Ard Biesheuvel wrote:
> On 9 March 2018 at 15:40, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> A recent update to the ARM SMCCC ARCH_WORKAROUND_1 specification
>> allows firmware to return a non zero, positive value to describe
>> that although the mitigation is implemented at the higher exception
>> level, the CPU on which the call is made is not affected.
>>
>> Let's relax the check on the return value from ARCH_WORKAROUND_1
>> so that we only error out if the returned value is negative.
>>
>> Fixes: b092201e0020 ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> OK, so this means the current code running on new firmware will
> erroneously assume that the mitigation is not implemented or needed if
> it, say, happens to run on the A53 cluster on Juno?

Yup, that's the problem. To my knowledge, there is no such firmware in
the wild, as the spec has just been published.

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
  2018-03-09 15:40 [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery Marc Zyngier
  2018-03-09 15:55 ` Ard Biesheuvel
@ 2018-03-09 17:52 ` Catalin Marinas
  1 sibling, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2018-03-09 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 09, 2018 at 03:40:50PM +0000, Marc Zyngier wrote:
> A recent update to the ARM SMCCC ARCH_WORKAROUND_1 specification
> allows firmware to return a non zero, positive value to describe
> that although the mitigation is implemented at the higher exception
> level, the CPU on which the call is made is not affected.
> 
> Let's relax the check on the return value from ARCH_WORKAROUND_1
> so that we only error out if the returned value is negative.
> 
> Fixes: b092201e0020 ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Queued for 4.16. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-09 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 15:40 [PATCH] arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery Marc Zyngier
2018-03-09 15:55 ` Ard Biesheuvel
2018-03-09 16:09   ` Marc Zyngier
2018-03-09 17:52 ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.