|
| 1 | +x86/bugs: Fix return type of spectre_bhi_state() |
| 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 Daniel Sneddon <daniel.sneddon@linux.intel.com> |
| 7 | +commit 04f4230e2f86a4e961ea5466eda3db8c1762004d |
| 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/04f4230e.failed |
| 11 | + |
| 12 | +The definition of spectre_bhi_state() incorrectly returns a const char |
| 13 | +* const. This causes the a compiler warning when building with W=1: |
| 14 | + |
| 15 | + warning: type qualifiers ignored on function return type [-Wignored-qualifiers] |
| 16 | + 2812 | static const char * const spectre_bhi_state(void) |
| 17 | + |
| 18 | +Remove the const qualifier from the pointer. |
| 19 | + |
| 20 | +Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob") |
| 21 | + Reported-by: Sean Christopherson <seanjc@google.com> |
| 22 | + Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com> |
| 23 | + Signed-off-by: Ingo Molnar <mingo@kernel.org> |
| 24 | + Cc: Linus Torvalds <torvalds@linux-foundation.org> |
| 25 | +Link: https://lore.kernel.org/r/20240409230806.1545822-1-daniel.sneddon@linux.intel.com |
| 26 | +(cherry picked from commit 04f4230e2f86a4e961ea5466eda3db8c1762004d) |
| 27 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 28 | + |
| 29 | +# Conflicts: |
| 30 | +# arch/x86/kernel/cpu/bugs.c |
| 31 | +diff --cc arch/x86/kernel/cpu/bugs.c |
| 32 | +index d1c0c8f6898b,27f5004a8e24..000000000000 |
| 33 | +--- a/arch/x86/kernel/cpu/bugs.c |
| 34 | ++++ b/arch/x86/kernel/cpu/bugs.c |
| 35 | +@@@ -2814,6 -2809,23 +2814,26 @@@ static char *pbrsb_eibrs_state(void |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | +++<<<<<<< HEAD |
| 40 | +++======= |
| 41 | ++ static const char *spectre_bhi_state(void) |
| 42 | ++ { |
| 43 | ++ if (!boot_cpu_has_bug(X86_BUG_BHI)) |
| 44 | ++ return "; BHI: Not affected"; |
| 45 | ++ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW)) |
| 46 | ++ return "; BHI: BHI_DIS_S"; |
| 47 | ++ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP)) |
| 48 | ++ return "; BHI: SW loop, KVM: SW loop"; |
| 49 | ++ else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && |
| 50 | ++ !(x86_read_arch_cap_msr() & ARCH_CAP_RRSBA)) |
| 51 | ++ return "; BHI: Retpoline"; |
| 52 | ++ else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT)) |
| 53 | ++ return "; BHI: Syscall hardening, KVM: SW loop"; |
| 54 | ++ |
| 55 | ++ return "; BHI: Vulnerable (Syscall hardening enabled)"; |
| 56 | ++ } |
| 57 | ++ |
| 58 | +++>>>>>>> 04f4230e2f86 (x86/bugs: Fix return type of spectre_bhi_state()) |
| 59 | + static ssize_t spectre_v2_show_state(char *buf) |
| 60 | + { |
| 61 | + if (spectre_v2_enabled == SPECTRE_V2_LFENCE) |
| 62 | +* Unmerged path arch/x86/kernel/cpu/bugs.c |
0 commit comments