diff options
author | David Kaplan <david.kaplan@amd.com> | 2025-09-15 08:47:04 -0500 |
---|---|---|
committer | Borislav Petkov (AMD) <bp@alien8.de> | 2025-09-16 12:59:55 +0200 |
commit | 30ef245c6f5a6842d60308590cf26d0ae836fbf0 (patch) | |
tree | 65ce3a3541644f217ebb68bfcc526c9b48587abb /scripts/gdb/linux/clk.py | |
parent | 440d20154add24082eb43305f85288a756a5cc56 (diff) |
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
Diffstat (limited to 'scripts/gdb/linux/clk.py')
0 files changed, 0 insertions, 0 deletions