Skip to contentSkip to conversation

xen/arm: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery

PATCH In review [email protected] 2 participants 3 messages Mar 12, 2018 – Mar 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery

From: Julien Grall <[email protected]>

A recent update to the ARM SMCCC_ARCH_WORKAROUND_1 specification (see [1]) 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.

Relax the check on the return value from ARM_WORKAROUND_1 so that we only error out if the returned value is negative.

[1] https://developer.arm.com/support/security-update/downloads
"Firmware interfaces for mitigating CVE-2017-5715 System Software on Arm Systems"

---
This patch should be backported as part of XSA-254.

There are potential more optimization to do as part of this relaxation. For instance, we dropping the CPU ID recognition and only look ad the SMCCC.

---
 xen/arch/arm/cpuerrata.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/cpuerrata.c +2 -1
index 4eb1567589..1baa20654b 100644
@@ -168,7 +168,8 @@ static int enable_smccc_arch_workaround_1(void *data)
 
     arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FID,
                       ARM_SMCCC_ARCH_WORKAROUND_1_FID, &res);
-    if ( res.a0 != ARM_SMCCC_SUCCESS )
+    /* The return value is in the lower 32-bits. */
+    if ( (int)res.a0 < 0 )
         goto warn;
 
     return !install_bp_hardening_vec(entry,__smccc_workaround_1_smc_start,
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Mon, 12 Mar 2018, [email protected] wrote:

From: Julien Grall <[email protected]>

A recent update to the ARM SMCCC_ARCH_WORKAROUND_1 specification (see [1]) 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.

Quoted 8 lines

Relax the check on the return value from ARM_WORKAROUND_1 so that we only error out if the returned value is negative.

[1] https://developer.arm.com/support/security-update/downloads
"Firmware interfaces for mitigating CVE-2017-5715 System Software on Arm Systems"

Quoted 6 lines

---
This patch should be backported as part of XSA-254.

There are potential more optimization to do as part of this relaxation. For instance, we dropping the CPU ID recognition and only look ad the SMCCC.

Indeed there are. I assume more patches will be coming?

Quoted 21 lines
---
 xen/arch/arm/cpuerrata.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/cpuerrata.c +2 -1
index 4eb1567589..1baa20654b 100644
@@ -168,7 +168,8 @@ static int enable_smccc_arch_workaround_1(void *data)
 
     arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FID,
                       ARM_SMCCC_ARCH_WORKAROUND_1_FID, &res);
-    if ( res.a0 != ARM_SMCCC_SUCCESS )
+    /* The return value is in the lower 32-bits. */
+    if ( (int)res.a0 < 0 )
         goto warn;
 
     return !install_bp_hardening_vec(entry,__smccc_workaround_1_smc_start,
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Hi Stefano,

Quoted 19 lines · Stefano Stabellini
Quoted 7 lines · On Mon, 12 Mar 2018, [email protected] wrote:

From: Julien Grall <[email protected]>

A recent update to the ARM SMCCC_ARCH_WORKAROUND_1 specification (see [1]) 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.

Quoted 8 lines

Relax the check on the return value from ARM_WORKAROUND_1 so that we only error out if the returned value is negative.

[1] https://developer.arm.com/support/security-update/downloads
"Firmware interfaces for mitigating CVE-2017-5715 System Software on Arm Systems"

Quoted 8 lines
Quoted 6 lines

---
This patch should be backported as part of XSA-254.

There are potential more optimization to do as part of this relaxation. For instance, we dropping the CPU ID recognition and only look ad the SMCCC.

Indeed there are. I assume more patches will be coming?

It is not in my immediate plan. I pointed out if someone wants to implement and send a patch.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel