[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c572de0-da38-c273-82ed-bafb86bbfa7a@arm.com>
Date: Thu, 13 Dec 2018 11:09:25 +0000
From: Julien Thierry <julien.thierry@....com>
To: Jeremy Linton <jeremy.linton@....com>,
linux-arm-kernel@...ts.infradead.org
Cc: catalin.marinas@....com, will.deacon@....com, marc.zyngier@....com,
suzuki.poulose@....com, dave.martin@....com,
shankerd@...eaurora.org, mark.rutland@....com,
linux-kernel@...r.kernel.org, ykaukab@...e.de
Subject: Re: [PATCH 4/6] arm64: add sysfs vulnerability show for spectre v2
On 06/12/2018 23:44, Jeremy Linton wrote:
> Add code to track whether all the cores in the machine are
> vulnerable, and whether all the vulnerable cores have been
> mitigated.
>
> Once we have that information we can add the sysfs stub and
> provide an accurate view of what is known about the machine.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@....com>
> ---
> arch/arm64/kernel/cpu_errata.c | 72 +++++++++++++++++++++++++++++++---
> 1 file changed, 67 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 559ecdee6fd2..6505c93d507e 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
[...]
> @@ -766,4 +812,20 @@ ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr,
> return sprintf(buf, "Mitigation: __user pointer sanitization\n");
> }
>
> +ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + switch (__spectrev2_safe) {
> + case A64_SV2_SAFE:
> + return sprintf(buf, "Not affected\n");
> + case A64_SV2_UNSAFE:
> + if (__hardenbp_enab == A64_HBP_MIT)
> + return sprintf(buf,
> + "Mitigation: Branch predictor hardening\n");
> + return sprintf(buf, "Vulnerable\n");
> + default:
> + return sprintf(buf, "Unknown\n");
> + }
Again I see that we are going to display "Unknown" when the mitigation
is not built in.
Couldn't we make that CONFIG_GENERIC_CPU_VULNERABILITIES check whether a
CPU is vulnerable or not even if the mitigation is not implemented? It's
just checking the list of MIDRs.
Thanks,
--
Julien Thierry
Powered by blists - more mailing lists