x86/split-lock: Avoid returning with interrupts enabled
authorAndi Kleen <ak@linux.intel.com>
Tue, 22 Dec 2020 17:40:10 +0000 (09:40 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Dec 2020 15:02:38 +0000 (16:02 +0100)
commit84bcbb0779c6a062e51c84abaca356f79be1abeb
treee80b28299e70a27c965914f85173673914371686
parenteadec7f5374ef01fa4556c24dfc90769ebaefd5e
x86/split-lock: Avoid returning with interrupts enabled

commit e14fd4ba8fb47fcf5f244366ec01ae94490cd86a upstream.

When a split lock is detected always make sure to disable interrupts
before returning from the trap handler.

The kernel exit code assumes that all exits run with interrupts
disabled, otherwise the SWAPGS sequence can race against interrupts and
cause recursing page faults and later panics.

The problem will only happen on CPUs with split lock disable
functionality, so Icelake Server, Tiger Lake, Snow Ridge, Jacobsville.

Fixes: ca4c6a9858c2 ("x86/traps: Make interrupt enable/disable symmetric in C code")
Fixes: bce9b042ec73 ("x86/traps: Disable interrupts in exc_aligment_check()") # v5.8+
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/traps.c