Commit ac5bd67
committed
x86/bugs: Fix spectre_v2 forcing
JIRA: https://issues.redhat.com/browse/RHEL-119227
commit 30ef245
Author: David Kaplan <david.kaplan@amd.com>
Date: Mon, 15 Sep 2025 08:47:04 -0500
x86/bugs: Fix spectre_v2 forcing
There were two oddities with spectre_v2 command line options.
First, any option other than 'off' or 'auto' would force spectre_v2
mitigations even if the CPU (hypothetically) wasn't vulnerable to spectre_v2.
That was inconsistent with all the other bugs where mitigations are ignored
unless an explicit 'force' option is specified.
Second, even though spectre_v2 mitigations would be enabled in these cases,
the X86_BUG_SPECTRE_V2 bit wasn't set. This is again inconsistent with the
forcing behavior of other bugs and arguably incorrect as it doesn't make sense
to enable a mitigation if the X86_BUG bit isn't set.
Fix both issues by only forcing spectre_v2 mitigations when the
'spectre_v2=on' option is specified (which was already called
SPECTRE_V2_CMD_FORCE) and setting the relevant X86_BUG_* bits in that case.
This also allows for simplifying bhi_update_mitigation() because
spectre_v2_cmd will now always be SPECTRE_V2_CMD_NONE if the CPU is immune to
spectre_v2.
Signed-off-by: David Kaplan <david.kaplan@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/20250915134706.3201818-1-david.kaplan@amd.com
Signed-off-by: Waiman Long <longman@redhat.com>1 parent b0c6499 commit ac5bd67
1 file changed
+18
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2057 | 2057 | | |
2058 | 2058 | | |
2059 | 2059 | | |
2060 | | - | |
| 2060 | + | |
2061 | 2061 | | |
2062 | | - | |
| 2062 | + | |
2063 | 2063 | | |
2064 | | - | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
2065 | 2067 | | |
2066 | | - | |
2067 | | - | |
| 2068 | + | |
| 2069 | + | |
2068 | 2070 | | |
2069 | | - | |
| 2071 | + | |
2070 | 2072 | | |
2071 | | - | |
| 2073 | + | |
2072 | 2074 | | |
2073 | | - | |
| 2075 | + | |
2074 | 2076 | | |
2075 | | - | |
| 2077 | + | |
2076 | 2078 | | |
2077 | | - | |
| 2079 | + | |
2078 | 2080 | | |
2079 | | - | |
| 2081 | + | |
2080 | 2082 | | |
2081 | | - | |
| 2083 | + | |
2082 | 2084 | | |
| 2085 | + | |
2083 | 2086 | | |
2084 | 2087 | | |
2085 | 2088 | | |
| |||
2232 | 2235 | | |
2233 | 2236 | | |
2234 | 2237 | | |
2235 | | - | |
2236 | | - | |
2237 | | - | |
2238 | | - | |
2239 | 2238 | | |
2240 | 2239 | | |
2241 | 2240 | | |
| |||
2316 | 2315 | | |
2317 | 2316 | | |
2318 | 2317 | | |
2319 | | - | |
2320 | | - | |
| 2318 | + | |
| 2319 | + | |
2321 | 2320 | | |
| 2321 | + | |
2322 | 2322 | | |
2323 | 2323 | | |
2324 | 2324 | | |
| |||
0 commit comments