Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commit61dc0f5

Browse files
committed
x86/cpu: Implement CPU vulnerabilites sysfs functions
Implement the CPU vulnerabilty show functions for meltdown, spectre_v1 andspectre_v2.Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Will Deacon <will.deacon@arm.com>Cc: Dave Hansen <dave.hansen@intel.com>Cc: Linus Torvalds <torvalds@linuxfoundation.org>Cc: Borislav Petkov <bp@alien8.de>Cc: David Woodhouse <dwmw@amazon.co.uk>Link:https://lkml.kernel.org/r/20180107214913.177414879@linutronix.de
1 parent87590ce commit61dc0f5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎arch/x86/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ config X86
8989
select GENERIC_CLOCKEVENTS_MIN_ADJUST
9090
select GENERIC_CMOS_UPDATE
9191
select GENERIC_CPU_AUTOPROBE
92+
select GENERIC_CPU_VULNERABILITIES
9293
select GENERIC_EARLY_IOREMAP
9394
select GENERIC_FIND_FIRST_BIT
9495
select GENERIC_IOMAP

‎arch/x86/kernel/cpu/bugs.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
#include<linux/init.h>
1212
#include<linux/utsname.h>
13+
#include<linux/cpu.h>
1314
#include<asm/bugs.h>
1415
#include<asm/processor.h>
1516
#include<asm/processor-flags.h>
@@ -60,3 +61,31 @@ void __init check_bugs(void)
6061
set_memory_4k((unsigned long)__va(0),1);
6162
#endif
6263
}
64+
65+
#ifdefCONFIG_SYSFS
66+
ssize_tcpu_show_meltdown(structdevice*dev,
67+
structdevice_attribute*attr,char*buf)
68+
{
69+
if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
70+
returnsprintf(buf,"Not affected\n");
71+
if (boot_cpu_has(X86_FEATURE_PTI))
72+
returnsprintf(buf,"Mitigation: PTI\n");
73+
returnsprintf(buf,"Vulnerable\n");
74+
}
75+
76+
ssize_tcpu_show_spectre_v1(structdevice*dev,
77+
structdevice_attribute*attr,char*buf)
78+
{
79+
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
80+
returnsprintf(buf,"Not affected\n");
81+
returnsprintf(buf,"Vulnerable\n");
82+
}
83+
84+
ssize_tcpu_show_spectre_v2(structdevice*dev,
85+
structdevice_attribute*attr,char*buf)
86+
{
87+
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
88+
returnsprintf(buf,"Not affected\n");
89+
returnsprintf(buf,"Vulnerable\n");
90+
}
91+
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp