lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180107221457.GT21689@char.us.oracle.com>
Date:   Sun, 7 Jan 2018 17:14:57 -0500
From:   Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Linus Torvalds <torvalds@...uxfoundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Borislav Petkov <bp@...en8.de>,
        David Woodhouse <dwmw@...zon.co.uk>,
        Dave Hansen <dave.hansen@...el.com>,
        Will Deacon <will.deacon@....com>
Subject: Re: [patch V2 2/2] x86/cpu: Implement CPU vulnerabilites sysfs
 functions

On Sun, Jan 07, 2018 at 10:48:01PM +0100, Thomas Gleixner wrote:
> Implement the CPU vulnerabilty show functions for meltdown, spectre_v1 and
> spectre_v2.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>

Thank you!
> ---
>  arch/x86/Kconfig           |    1 +
>  arch/x86/kernel/cpu/bugs.c |   29 +++++++++++++++++++++++++++++
>  2 files changed, 30 insertions(+)
> 
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -89,6 +89,7 @@ config X86
>  	select GENERIC_CLOCKEVENTS_MIN_ADJUST
>  	select GENERIC_CMOS_UPDATE
>  	select GENERIC_CPU_AUTOPROBE
> +	select GENERIC_CPU_VULNERABILITIES
>  	select GENERIC_EARLY_IOREMAP
>  	select GENERIC_FIND_FIRST_BIT
>  	select GENERIC_IOMAP
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -10,6 +10,7 @@
>   */
>  #include <linux/init.h>
>  #include <linux/utsname.h>
> +#include <linux/cpu.h>
>  #include <asm/bugs.h>
>  #include <asm/processor.h>
>  #include <asm/processor-flags.h>
> @@ -60,3 +61,31 @@ void __init check_bugs(void)
>  		set_memory_4k((unsigned long)__va(0), 1);
>  #endif
>  }
> +
> +#ifdef CONFIG_SYSFS
> +ssize_t cpu_show_meltdown(struct device *dev,
> +			  struct device_attribute *attr, char *buf)
> +{
> +	if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
> +		return sprintf(buf, "Not affected\n");
> +	if (boot_cpu_has(X86_FEATURE_PTI))
> +		return sprintf(buf, "Mitigation: PTI\n");
> +	return sprintf(buf, "Vulnerable\n");
> +}
> +
> +ssize_t cpu_show_spectre_v1(struct device *dev,
> +			    struct device_attribute *attr, char *buf)
> +{
> +	if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
> +		return sprintf(buf, "Not affected\n");
> +	return sprintf(buf, "Vulnerable\n");
> +}
> +
> +ssize_t cpu_show_spectre_v2(struct device *dev,
> +			    struct device_attribute *attr, char *buf)
> +{
> +	if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
> +		return sprintf(buf, "Not affected\n");
> +	return sprintf(buf, "Vulnerable\n");
> +}
> +#endif
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ