linux-stable/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
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
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
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
xen xen: branch for v6.1-rc6 2022-11-16 10:49:06 -08:00
.gitignore
Kbuild
Kconfig x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB 2022-10-17 19:11:16 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
Makefile.um
Makefile_32.cpu