linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RESEND 2/6] arm64: add sysfs vulnerability show for meltdown
Date: Mon, 17 Sep 2018 14:30:38 +0100	[thread overview]
Message-ID: <20180917133037.GB23040@arm.com> (raw)
In-Reply-To: <20180827143310.641-3-ykaukab@suse.de>

On Mon, Aug 27, 2018 at 04:33:06PM +0200, Mian Yousaf Kaukab wrote:
> Checking CSV3 support directly in case CONFIG_UNMAP_KERNEL_AT_EL0
> is not enabled.
> 
> Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
> ---
>  arch/arm64/kernel/cpu_errata.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index dec10898d688..996edb4e18ad 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -22,6 +22,7 @@
>  #include <asm/cpu.h>
>  #include <asm/cputype.h>
>  #include <asm/cpufeature.h>
> +#include <asm/mmu.h>
>  
>  static bool __maybe_unused
>  is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
> @@ -683,3 +684,26 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
>  	{
>  	}
>  };
> +
> +#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
> +
> +ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr,
> +		char *buf)
> +{
> +	u64 pfr0;
> +	u32 csv3;
> +
> +	if (arm64_kernel_unmapped_at_el0())
> +		return sprintf(buf, "Mitigation: KPTI\n");
> +
> +	pfr0 = read_cpuid(ID_AA64PFR0_EL1);
> +	csv3 = cpuid_feature_extract_unsigned_field(pfr0,
> +			ID_AA64PFR0_CSV3_SHIFT);
> +
> +	if (csv3 || is_cpu_meltdown_safe())
> +		return sprintf(buf, "Not affected\n");
> +
> +	return sprintf(buf, "Vulnerable\n");

This should say something like "Unknown", since we don't actually have a
reliable way to determine that a CPU is vulnerable. That's also a large
part of the reason why we haven't bothered implementing the sysfs interface
so far.

Will

  reply	other threads:[~2018-09-17 13:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 14:33 [PATCH RESEND 0/6] arm64: add support for generic cpu vulnerabilities Mian Yousaf Kaukab
2018-08-27 14:33 ` [PATCH RESEND 1/6] arm64: kpti: move check for non-vulnerable CPUs to a function Mian Yousaf Kaukab
2018-08-27 14:33 ` [PATCH RESEND 2/6] arm64: add sysfs vulnerability show for meltdown Mian Yousaf Kaukab
2018-09-17 13:30   ` Will Deacon [this message]
2018-08-27 14:33 ` [PATCH RESEND 3/6] arm64: add sysfs vulnerability show for spectre v1 Mian Yousaf Kaukab
2018-09-17 17:22   ` Robert Richter
2018-09-18  8:38     ` Will Deacon
2018-09-18  9:52       ` Robert Richter
2018-09-18 17:15         ` Will Deacon
2018-09-19  6:57           ` Robert Richter
2018-08-27 14:33 ` [PATCH RESEND 4/6] arm64: add sysfs vulnerability show for spectre v2 Mian Yousaf Kaukab
2018-09-17 13:30   ` Will Deacon
2018-08-27 14:33 ` [PATCH RESEND 5/6] arm64: add sysfs vulnerability show for speculative store bypass Mian Yousaf Kaukab
2018-09-17 13:30   ` Will Deacon
2018-08-27 14:33 ` [PATCH RESEND 6/6] arm64: enable generic CPU vulnerabilites support Mian Yousaf Kaukab
2018-09-05  9:25 ` [PATCH RESEND 0/6] arm64: add support for generic cpu vulnerabilities Mian Yousaf Kaukab
2018-09-17 13:35   ` Will Deacon
2018-09-24 10:06     ` Mian Yousaf Kaukab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917133037.GB23040@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).