android_kernel_msm-6.1_noth.../arch
Thomas Gleixner 0af4750eaa x86/smp: Cure kexec() vs. mwait_play_dead() breakage
commit d7893093a7417527c0d73c9832244e65c9d0114f upstream.

TLDR: It's a mess.

When kexec() is executed on a system with offline CPUs, which are parked in
mwait_play_dead() it can end up in a triple fault during the bootup of the
kexec kernel or cause hard to diagnose data corruption.

The reason is that kexec() eventually overwrites the previous kernel's text,
page tables, data and stack. If it writes to the cache line which is
monitored by a previously offlined CPU, MWAIT resumes execution and ends
up executing the wrong text, dereferencing overwritten page tables or
corrupting the kexec kernels data.

Cure this by bringing the offlined CPUs out of MWAIT into HLT.

Write to the monitored cache line of each offline CPU, which makes MWAIT
resume execution. The written control word tells the offlined CPUs to issue
HLT, which does not have the MWAIT problem.

That does not help, if a stray NMI, MCE or SMI hits the offlined CPUs as
those make it come out of HLT.

A follow up change will put them into INIT, which protects at least against
NMI and SMI.

Fixes: ea53069231 ("x86, hotplug: Use mwait to offline a processor, fix the legacy case")
Reported-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Ashok Raj <ashok.raj@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230615193330.492257119@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-01 13:16:23 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:50:31 +01:00
arc
arm ARM: dts: Fix erroneous ADS touchscreen polarities 2023-06-28 11:12:39 +02:00
arm64 KVM: arm64: Restore GICv2-on-GICv3 functionality 2023-06-28 11:12:40 +02:00
csky
hexagon
ia64 ia64: fix an addr to taddr in huge_pte_offset() 2023-05-11 23:03:40 +09:00
loongarch LoongArch: Fix perf event id calculation 2023-06-21 16:00:54 +02:00
m68k m68k: Move signal frame following exception on 68020/030 2023-05-30 14:03:18 +01:00
microblaze kbuild: fix "cat: .version: No such file or directory" 2022-11-24 09:26:02 +09:00
mips MIPS: Prefer cc-option for additions to cflags 2023-06-21 16:01:03 +02:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 16:00:54 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-11 23:03:35 +09:00
parisc parisc: Delete redundant register definitions in <asm/assembly.h> 2023-06-21 16:01:02 +02:00
powerpc powerpc/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
riscv riscv/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
s390 s390/purgatory: disable branch profiling 2023-06-28 11:12:38 +02:00
sh sh: nmi_debug: fix return value of __setup handler 2023-05-17 11:53:45 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-10 09:33:27 +01:00
um um: harddog: fix modular build 2023-06-09 10:34:10 +02:00
x86 x86/smp: Cure kexec() vs. mwait_play_dead() breakage 2023-07-01 13:16:23 +02:00
xtensa xtensa: add __bswap{si,di}2 helpers 2023-05-30 14:03:18 +01:00
.gitignore
Kconfig ftrace: Allow WITH_ARGS flavour of graph tracer with shadow call stack 2022-12-31 13:32:45 +01:00