xen/arm: Warn user on cpu errata 832075
v2 cover xen/arm: Warn user on cpu errata 832075
This serie is a v2 after a discussion of [1] to introduce several changes to handle properly the warning for Arm cpu errata 832075:
- use printk_once instead of warning add
- introduce a tainted type "Unsecure"
The last patch is adding the warning and flags A57 core affected as unsupported.
[1] https://lists.xenproject.org/archives/html/xen-devel/2020-10/msg00896.html
Bertrand Marquis (3):
xen/arm: use printk_once for errata warning prints
xen: Add an unsecure Taint type
xen/arm: Warn user on cpu errata 832075
SUPPORT.md | 1 + xen/arch/arm/cpuerrata.c | 23 +++++++++++++++-------- xen/common/kernel.c | 4 +++- xen/include/xen/lib.h | 1 + 4 files changed, 20 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/3 xen/arm: use printk_once for errata warning prints
Replace usage of warning_add by printk_once with a **** prefix and suffix for errata related warnings.
This prevents the need for the assert which is not secure enough to protect this print against wrong usage.
--- xen/arch/arm/cpuerrata.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
xen/arch/arm/cpuerrata.c +2 -8
@@ -157,7 +157,6 @@ extern char __smccc_workaround_1_smc_start[], __smccc_workaround_1_smc_end[];static int enable_smccc_arch_workaround_1 (void *data) {struct arm_smccc_res res; -static bool warned = false;const struct arm_cpu_capabilities *entry = data;/*
@@ -182,13 +181,8 @@ static int enable_smccc_arch_workaround_1(void *data) "call ARM_SMCCC_ARCH_WORKAROUND_1"); warn: -if ( !warned ) - { -ASSERT (system_state < SYS_STATE_active); -warning_add ("No support for ARM_SMCCC_ARCH_WORKAROUND_1.\n" -"Please update your firmware.\n" ); - warned = true; - } +printk_once ("**** No support for ARM_SMCCC_ARCH_WORKAROUND_1. ****\n" +"**** Please update your firmware. ****\n" );return 0 ; }
Signature · 1 line
2.17.1
PATCH v2 2/3 xen: Add an unsecure Taint type
Define a new Unsecure taint type to be used to signal a system tainted due to an unsecure configuration or hardware feature/errata.
--- xen/common/kernel.c | 4 +++- xen/include/xen/lib.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
xen/common/kernel.c +3 -1
@@ -326,6 +326,7 @@ unsigned int tainted;* 'E' - An error (e.g. a machine check exceptions) has been injected. * 'H' - HVM forced emulation prefix is permitted. * 'M' - Machine had a machine check experience. +* 'U' - Platform is unsecure (usually due to an errata on the platform). * * The string is overwritten by the next call to print_taint(). */
@@ -333,7 +334,8 @@ char *print_tainted(char *str) {if ( tainted ) { - snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c", + snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c", + tainted & TAINT_MACHINE_UNSECURE ? 'U' : ' ', tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ', tainted & TAINT_ERROR_INJECT ? 'E' : ' ',
xen/include/xen/lib.h +1 -0
@@ -193,6 +193,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);#define TAINT_MACHINE_CHECK (1u << 1)#define TAINT_ERROR_INJECT (1u << 2)#define TAINT_HVM_FEP (1u << 3) +#define TAINT_MACHINE_UNSECURE (1u << 4)extern unsigned int tainted;#define TAINT_STRING_MAX_LEN 20extern char *print_tainted (char *str);
Signature · 1 line
2.17.1
PATCH v2 3/3 xen/arm: Warn user on cpu errata 832075
In reply to Bertrand MarquisWhen a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.
Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
--- SUPPORT.md | 1 + xen/arch/arm/cpuerrata.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)
SUPPORT.md +1 -0
@@ -38,6 +38,7 @@ supported in this document. ### ARM v8 Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075) ## Host hardware support
xen/arch/arm/cpuerrata.c +13 -0
@@ -503,6 +503,19 @@ void check_local_cpu_errata(void)void __init enable_errata_workarounds (void ) {enable_cpu_capabilities (arm_errata); + +#ifdef CONFIG_ARM64_ERRATUM_832075 +if (cpus_have_cap (ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE ) ) + { +printk_once ("**** This CPU is affected by the errata 832075. ****\n" +"**** Guests without CPU erratum workarounds ****\n" +"**** can deadlock the system! ****\n" +"**** Only trusted guests should be used. ****\n" ); + +/* Taint the machine has being insecure */ +add_taint (TAINT_MACHINE_UNSECURE ); + } +#endif } static int cpu_errata_callback(struct notifier_block *nfb,
Signature · 1 line
2.17.1
Re: [PATCH v2 1/3] xen/arm: use printk_once for errata warning prints
In reply to Bertrand MarquisQuoted 7 lines · Bertrand Marquis
Replace usage of
warning_addbyprintk_oncewith a **** prefix and suffix for errata related warnings.This prevents the need for the assert which is not secure enough to protect this print against wrong usage.
Signed-off-by Bertrand Marquis <[email protected]>
Quoted 35 lines
--- xen/arch/arm/cpuerrata.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)xen/arch/arm/cpuerrata.c +2
-8@@ -157,7 +157,6 @@ extern char __smccc_workaround_1_smc_start[], __smccc_workaround_1_smc_end[];static int enable_smccc_arch_workaround_1 (void *data) {struct arm_smccc_res res; -static bool warned = false;const struct arm_cpu_capabilities *entry = data;/* @@ -182,13 +181,8 @@ static int enable_smccc_arch_workaround_1(void *data) "call ARM_SMCCC_ARCH_WORKAROUND_1"); warn: -if ( !warned ) - { -ASSERT (system_state < SYS_STATE_active); -warning_add ("No support for ARM_SMCCC_ARCH_WORKAROUND_1.\n" -"Please update your firmware.\n" ); - warned = true; - } +printk_once ("**** No support for ARM_SMCCC_ARCH_WORKAROUND_1. ****\n" +"**** Please update your firmware. ****\n" );return 0 ; }Signature · 1 line
2.17.1
Re: [PATCH v2 2/3] xen: Add an unsecure Taint type
In reply to Bertrand MarquisQuoted 4 lines · Bertrand Marquis
Define a new Unsecure taint type to be used to signal a system tainted due to an unsecure configuration or hardware feature/errata.
Signed-off-by Bertrand Marquis <[email protected]>
Quoted 42 lines
--- xen/common/kernel.c | 4 +++- xen/include/xen/lib.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)xen/common/kernel.c +3
-1@@ -326,6 +326,7 @@ unsigned int tainted;* 'E' - An error (e.g. a machine check exceptions) has been injected. * 'H' - HVM forced emulation prefix is permitted. * 'M' - Machine had a machine check experience. +* 'U' - Platform is unsecure (usually due to an errata on the platform). * * The string is overwritten by the next call to print_taint(). */ @@ -333,7 +334,8 @@ char *print_tainted(char *str) {if ( tainted ) { - snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c", + snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c", + tainted & TAINT_MACHINE_UNSECURE ? 'U' : ' ', tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ', tainted & TAINT_ERROR_INJECT ? 'E' : ' ',xen/include/xen/lib.h +1
-0@@ -193,6 +193,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);#define TAINT_MACHINE_CHECK (1u << 1)#define TAINT_ERROR_INJECT (1u << 2)#define TAINT_HVM_FEP (1u << 3) +#define TAINT_MACHINE_UNSECURE (1u << 4)extern unsigned int tainted;#define TAINT_STRING_MAX_LEN 20extern char *print_tainted (char *str);Signature · 1 line
2.17.1
Quoted 34 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>--- SUPPORT.md | 1 + xen/arch/arm/cpuerrata.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)SUPPORT.md +1
-0@@ -38,6 +38,7 @@ supported in this document. ### ARM v8 Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075) ## Host hardware supportxen/arch/arm/cpuerrata.c +0
-0@@ -503,6 +503,19 @@ void check_local_cpu_errata(void)void __init enable_errata_workarounds (void )
xen/arch/arm/cpuerrata.c void check_local_cpu_errata(void) · line 513
Quoted 10 lines
xen/arch/arm/cpuerrata.c +8
-0{enable_cpu_capabilities (arm_errata); + +#ifdef CONFIG_ARM64_ERRATUM_832075 +if (cpus_have_cap (ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE ) ) + { +printk_once ("**** This CPU is affected by the errata 832075. ****\n" +"**** Guests without CPU erratum workarounds ****\n" +"**** can deadlock the system! ****\n" +"**** Only trusted guests should be used. ****\n" );
These can be on 2 lines, no need to be on 4 lines.
I know that Julien wrote about printing the warning from enable_errata_workarounds but to me it looks more natural if we did it from the .enable function specific to ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE.
That said, I don't feel strongly about it, I am fine either way. Julien, do you have a preference?
Other than that, it is fine.
Quoted 4 lines
xen/arch/arm/cpuerrata.c +4
-0+/* Taint the machine has being insecure */ + add_taint(TAINT_MACHINE_UNSECURE); + } +#endif
Quoted 43 lines · Stefano Stabellini
Quoted 38 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>---
SUPPORT.md | 1 +xen/arch/arm/cpuerrata.c| 13 +++++++++++++2 files changed, 14 insertions(+)SUPPORT.md +1
-0@@ -38,6 +38,7 @@ supported in this document. ### ARM v8 Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075) ## Host hardware supportxen/arch/arm/cpuerrata.c +2
-0@@ -503,6 +503,19 @@ void check_local_cpu_errata(void)void __init enable_errata_workarounds (void ) {enable_cpu_capabilities (arm_errata); + +#ifdef CONFIG_ARM64_ERRATUM_832075
Quoted 8 lines
xen/arch/arm/cpuerrata.c void check_local_cpu_errata(void) · line 513
Quoted 6 lines
xen/arch/arm/cpuerrata.c +6
-0+if (cpus_have_cap (ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE ) ) + { +printk_once ("**** This CPU is affected by the errata 832075. ****\n" +"**** Guests without CPU erratum workarounds ****\n" +"**** can deadlock the system! ****\n" +"**** Only trusted guests should be used. ****\n" );These can be on 2 lines, no need to be on 4 lines.
I can fix that in a v3.
Quoted 5 lines
I know that Julien wrote about printing the warning from
enable_errata_workaroundsbut to me it looks more natural if we did it from the .enable function specific toARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE.
I have no preference either here but i kind of like this way because if we had more warnings they would allow be at the same place.
I will wait for Julien answer on this before sending a v3 for this patch.
Cheers
Bertrand
Quoted 12 lines
That said, I don't feel strongly about it, I am fine either way. Julien, do you have a preference?
Other than that, it is fine.
Quoted 4 lines
xen/arch/arm/cpuerrata.c +4
-0+/* Taint the machine has being insecure */ + add_taint(TAINT_MACHINE_UNSECURE); + } +#endif
Quoted 32 lines · Bertrand Marquis
Quoted 29 lines · Stefano Stabellini
Quoted 23 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>---
SUPPORT.md | 1 +xen/arch/arm/cpuerrata.c| 13 +++++++++++++2 files changed, 14 insertions(+)SUPPORT.md +0
-0@@ -38,6 +38,7 @@ supported in this document. ### ARM v8
Quoted 2 lines
Quoted 2 lines
SUPPORT.md supported in this document. · line 41
Quoted 2 lines
SUPPORT.md +1
-0Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075)
I think this should be:
8<—
Status, Cortex A57 r0p0-r1p1: Supported, not security supported
For the Cortex A57 r0p0 - r1p1, see Errata 832075.
—>8
-George
Hi George,
Quoted 39 lines · George Dunlap
Quoted 33 lines · Bertrand Marquis
Quoted 29 lines · Stefano Stabellini
Quoted 23 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>---
SUPPORT.md | 1 +xen/arch/arm/cpuerrata.c| 13 +++++++++++++2 files changed, 14 insertions(+)SUPPORT.md +0
-0@@ -38,6 +38,7 @@ supported in this document. ### ARM v8Quoted 2 lines
Quoted 2 lines
SUPPORT.md supported in this document. · line 41
Quoted 2 lines
SUPPORT.md +1
-0Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075)I think this should be:
Quoted 8 lines
8<—
Status, Cortex A57 r0p0-r1p1: Supported, not security supported
For the Cortex A57 r0p0 - r1p1, see Errata 832075.
—>8
Ok I will fix that.
Thanks for the review
Cheers
Bertrand
Quoted 1 line
-George
Hi,
Quoted 56 lines · Bertrand Marquis
Quoted 43 lines · Stefano Stabellini
Quoted 38 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>---
SUPPORT.md | 1 +xen/arch/arm/cpuerrata.c| 13 +++++++++++++2 files changed, 14 insertions(+)SUPPORT.md +1
-0@@ -38,6 +38,7 @@ supported in this document. ### ARM v8 Status: Supported + Status, Cortex A57 r0p0 - r1p2, not security supported (Errata 832075) ## Host hardware supportxen/arch/arm/cpuerrata.c +2
-0@@ -503,6 +503,19 @@ void check_local_cpu_errata(void)void __init enable_errata_workarounds (void ) {enable_cpu_capabilities (arm_errata); + +#ifdef CONFIG_ARM64_ERRATUM_832075 Quoted 8 lines
xen/arch/arm/cpuerrata.c void check_local_cpu_errata(void) · line 513
Quoted 6 lines
xen/arch/arm/cpuerrata.c +6
-0+if (cpus_have_cap (ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE ) ) + { +printk_once ("**** This CPU is affected by the errata 832075. ****\n" +"**** Guests without CPU erratum workarounds ****\n" +"**** can deadlock the system! ****\n" +"**** Only trusted guests should be used. ****\n" );These can be on 2 lines, no need to be on 4 lines.
I can fix that in a v3.
Quoted 2 lines
Quoted 6 lines
Quoted 3 lines
I know that Julien wrote about printing the warning from
enable_errata_workaroundsbut to me it looks more natural if we did it from the .enable function specific toARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE.I have no preference either here but i kind of like this way because if we had more warnings they would allow be at the same place.
So I add this placement in mind because the previous version was using warning_add() (It can't be called from non-init helper). As we are using printk_once() now, I don't really have a preference.
So I would stick with what you wrote.
Cheers,
Signature · 1 line
Julien Grall
Hi Bertrand,
Quoted 11 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Signed-off-by Bertrand Marquis <[email protected]>
If you don't need to resend the series, then I would be happy to fix the typo pointed out by George on commit.
Cheers,
Signature · 1 line
Julien Grall
Quoted 13 lines · Julien Grall
Hi Bertrand,
Quoted 10 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
Quoted 6 lines
Quoted 1 line
Signed-off-by Bertrand Marquis <[email protected]>Reviewed-by Julien Grall <[email protected]>If you don't need to resend the series, then I would be happy to fix the typo pointed out by George on commit.
That's OK for me. Since you are at it, could you also condense the 4 lines of the warning into 2 lines on commit as well?
Thanks,
Stefano
Hi Julien,
Quoted 15 lines · Julien Grall
Hi Bertrand,
Quoted 9 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.
Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.mdSigned-off-by Bertrand Marquis <[email protected]>
Quoted 1 line
Reviewed-by Julien Grall <[email protected]>
Thanks
Quoted 2 lines
If you don't need to resend the series, then I would be happy to fix the typo pointed out by George on commit.
There is only the condensing from Stefano.
If you can handle that on commit to great but if you need me to send a v3 to make your life easier do not hesitate to tell me
Cheers
Bertrand
Quoted 6 lines
Cheers,
Signature · 1 line
Julien Grall
Quoted 19 lines · Bertrand Marquis
Hi Julien,
Quoted 15 lines · Julien Grall
Hi Bertrand,
Quoted 9 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.
Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.mdSigned-off-by Bertrand Marquis <[email protected]>Quoted 1 line
Reviewed-by Julien Grall <[email protected]>
Quoted 7 lines
Thanks
Quoted 2 lines
If you don't need to resend the series, then I would be happy to fix the typo pointed out by George on commit.
There is only the condensing from Stefano.
If you can handle that on commit to great but if you need me to send a v3 to make your life easier do not hesitate to tell me
I have just done the committing
Quoted 27 lines · Stefano Stabellini
Quoted 22 lines · Bertrand Marquis
Hi Julien,
Quoted 15 lines · Julien Grall
Hi Bertrand,
Quoted 9 lines · Bertrand Marquis
When a Cortex A57 processor is affected by CPU errata 832075, a guest not implementing the workaround for it could deadlock the system. Add a warning during boot informing the user that only trusted guests should be executed on the system.
An equivalent warning is already given to the user by KVM on cores affected by this errata.
Also taint the hypervisor as unsecure when this errata applies and mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.mdSigned-off-by Bertrand Marquis <[email protected]>Quoted 1 line
Reviewed-by Julien Grall <[email protected]>Thanks
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
If you don't need to resend the series, then I would be happy to fix the typo pointed out by George on commit.
There is only the condensing from Stefano.
If you can handle that on commit to great but if you need me to send a v3 to make your life easier do not hesitate to tell meI have just done the committing
Thanks a lot :-)
Cheers
Bertrand