Skip to content

Commit 27aa4d5

Browse files
committed
x86/bugs: Cache the value of MSR_IA32_ARCH_CAPABILITIES
jira LE-2015 cve CVE-2024-2201 Rebuild_History Non-Buildable kernel-5.14.0-427.42.1.el9_4 commit-author Josh Poimboeuf <jpoimboe@kernel.org> commit cb2db5b Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-427.42.1.el9_4/cb2db5bb.failed There's no need to keep reading MSR_IA32_ARCH_CAPABILITIES over and over. It's even read in the BHI sysfs function which is a big no-no. Just read it once and cache it. Fixes: ec9404e ("x86/bhi: Add BHI mitigation knob") Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/9592a18a814368e75f8f4b9d74d3883aa4fd1eaf.1712813475.git.jpoimboe@kernel.org (cherry picked from commit cb2db5b) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # arch/x86/kernel/cpu/bugs.c
1 parent a399925 commit 27aa4d5

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
x86/bugs: Cache the value of MSR_IA32_ARCH_CAPABILITIES
2+
3+
jira LE-2015
4+
cve CVE-2024-2201
5+
Rebuild_History Non-Buildable kernel-5.14.0-427.42.1.el9_4
6+
commit-author Josh Poimboeuf <jpoimboe@kernel.org>
7+
commit cb2db5bb04d7f778fbc1a1ea2507aab436f1bff3
8+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
9+
Will be included in final tarball splat. Ref for failed cherry-pick at:
10+
ciq/ciq_backports/kernel-5.14.0-427.42.1.el9_4/cb2db5bb.failed
11+
12+
There's no need to keep reading MSR_IA32_ARCH_CAPABILITIES over and
13+
over. It's even read in the BHI sysfs function which is a big no-no.
14+
Just read it once and cache it.
15+
16+
Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
17+
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
18+
Signed-off-by: Ingo Molnar <mingo@kernel.org>
19+
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
20+
Cc: Linus Torvalds <torvalds@linux-foundation.org>
21+
Cc: Sean Christopherson <seanjc@google.com>
22+
Link: https://lore.kernel.org/r/9592a18a814368e75f8f4b9d74d3883aa4fd1eaf.1712813475.git.jpoimboe@kernel.org
23+
(cherry picked from commit cb2db5bb04d7f778fbc1a1ea2507aab436f1bff3)
24+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
25+
26+
# Conflicts:
27+
# arch/x86/kernel/cpu/bugs.c
28+
diff --cc arch/x86/kernel/cpu/bugs.c
29+
index d1c0c8f6898b,ff59fa8bb610..000000000000
30+
--- a/arch/x86/kernel/cpu/bugs.c
31+
+++ b/arch/x86/kernel/cpu/bugs.c
32+
@@@ -2814,6 -2801,23 +2806,26 @@@ static char *pbrsb_eibrs_state(void
33+
}
34+
}
35+
36+
++<<<<<<< HEAD
37+
++=======
38+
+ static const char *spectre_bhi_state(void)
39+
+ {
40+
+ if (!boot_cpu_has_bug(X86_BUG_BHI))
41+
+ return "; BHI: Not affected";
42+
+ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW))
43+
+ return "; BHI: BHI_DIS_S";
44+
+ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP))
45+
+ return "; BHI: SW loop, KVM: SW loop";
46+
+ else if (boot_cpu_has(X86_FEATURE_RETPOLINE) &&
47+
+ !(ia32_cap & ARCH_CAP_RRSBA))
48+
+ return "; BHI: Retpoline";
49+
+ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT))
50+
+ return "; BHI: Syscall hardening, KVM: SW loop";
51+
+
52+
+ return "; BHI: Vulnerable (Syscall hardening enabled)";
53+
+ }
54+
+
55+
++>>>>>>> cb2db5bb04d7 (x86/bugs: Cache the value of MSR_IA32_ARCH_CAPABILITIES)
56+
static ssize_t spectre_v2_show_state(char *buf)
57+
{
58+
if (spectre_v2_enabled == SPECTRE_V2_LFENCE)
59+
* Unmerged path arch/x86/kernel/cpu/bugs.c

0 commit comments

Comments
 (0)