OpenCloudOS-Kernel/arch/x86
Pawan Gupta 6606515742 x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3
The "force" argument to write_spec_ctrl_current() is currently ambiguous
as it does not guarantee the MSR write. This is due to the optimization
that writes to the MSR happen only when the new value differs from the
cached value.

This is fine in most cases, but breaks for S3 resume when the cached MSR
value gets out of sync with the hardware MSR value due to S3 resetting
it.

When x86_spec_ctrl_current is same as x86_spec_ctrl_base, the MSR write
is skipped. Which results in SPEC_CTRL mitigations not getting restored.

Move the MSR write from write_spec_ctrl_current() to a new function that
unconditionally writes to the MSR. Update the callers accordingly and
rename functions.

  [ bp: Rework a bit. ]

Fixes: caa0ff24d5 ("x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value")
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/806d39b0bfec2fe8f50dc5446dff20f5bb24a959.1669821572.git.pawan.kumar.gupta@linux.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-12-02 15:45:33 -08:00
..
boot kbuild: fix "cat: .version: No such file or directory" 2022-11-24 09:26:02 +09:00
coco x86/tdx: Panic on bad configs that #VE on "private" memory access 2022-11-01 16:02:40 -07:00
configs x86/defconfig: Enable CONFIG_DEBUG_WX=y 2022-09-02 10:41:42 +02:00
crypto crypto: x86/polyval - Fix crashes when keys are not 16-byte aligned 2022-10-21 19:05:05 +08:00
entry treewide: use prandom_u32_max() when possible, part 1 2022-10-11 17:42:55 -06:00
events perf/x86/intel/pt: Fix sampling using single range output 2022-11-16 10:12:59 +01:00
hyperv x86/hyperv: Restore VP assist page after cpu offlining/onlining 2022-11-11 23:33:30 +00:00
ia32 x86: Remove a.out support 2022-04-11 18:04:27 +02:00
include x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3 2022-12-02 15:45:33 -08:00
kernel x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3 2022-12-02 15:45:33 -08:00
kvm x86: 2022-11-27 09:08:40 -08:00
lib x86/uaccess: instrument copy_from_user_nmi() 2022-11-08 15:57:24 -08:00
math-emu x86/32: Remove lazy GS macros 2022-04-14 14:09:43 +02:00
mm x86/ioremap: Fix page aligned size calculation in __ioremap_caller() 2022-11-22 12:21:16 +01:00
net bpf: Revert ("Fix dispatcher patchable function entry to 5 bytes nop") 2022-11-04 23:13:08 +01:00
pci x86/PCI: Revert "x86/PCI: Clip only host bridge windows for E820 regions" 2022-06-17 14:24:14 -05:00
platform EFI updates for v6.1 2022-10-09 08:56:54 -07:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-11-21 14:16:16 +01:00
purgatory x86/purgatory: disable KMSAN instrumentation 2022-10-28 13:37:23 -07:00
ras
realmode x86: kmsan: disable instrumentation of unsupported code 2022-10-03 14:03:24 -07:00
tools x86/tools/relocs: Ignore __kcfi_typeid_ relocations 2022-09-26 10:13:15 -07:00
um arch: um: Mark the stack non-executable to fix a binutils warning 2022-09-21 09:11:42 +02:00
video
virt/vmx/tdx x86/tdx: Provide common base for SEAMCALL and TDCALL C wrappers 2022-04-07 08:27:50 -07:00
xen xen: branch for v6.1-rc6 2022-11-16 10:49:06 -08:00
.gitignore x86/purgatory: Omit use of bin2c 2022-07-25 10:32:32 +02:00
Kbuild x86/cc: Move arch/x86/{kernel/cc_platform.c => coco/core.c} 2022-02-23 18:25:58 +01:00
Kconfig x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB 2022-10-17 19:11:16 +02:00
Kconfig.assembler
Kconfig.cpu x86/mmx_32: Remove X86_USE_3DNOW 2021-12-11 09:09:45 +01:00
Kconfig.debug arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-06-23 15:39:21 +01:00
Makefile Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
Makefile.um
Makefile_32.cpu