linux_dsm_epyc7002/arch
Matt Fleming 96738c69a7 x86/efi: Avoid triple faults during EFI mixed mode calls
Andy pointed out that if an NMI or MCE is received while we're in the
middle of an EFI mixed mode call a triple fault will occur. This can
happen, for example, when issuing an EFI mixed mode call while running
perf.

The reason for the triple fault is that we execute the mixed mode call
in 32-bit mode with paging disabled but with 64-bit kernel IDT handlers
installed throughout the call.

At Andy's suggestion, stop playing the games we currently do at runtime,
such as disabling paging and installing a 32-bit GDT for __KERNEL_CS. We
can simply switch to the __KERNEL32_CS descriptor before invoking
firmware services, and run in compatibility mode. This way, if an
NMI/MCE does occur the kernel IDT handler will execute correctly, since
it'll jump to __KERNEL_CS automatically.

However, this change is only possible post-ExitBootServices(). Before
then the firmware "owns" the machine and expects for its 32-bit IDT
handlers to be left intact to service interrupts, etc.

So, we now need to distinguish between early boot and runtime
invocations of EFI services. During early boot, we need to restore the
GDT that the firmware expects to be present. We can only jump to the
__KERNEL32_CS code segment for mixed mode calls after ExitBootServices()
has been invoked.

A liberal sprinkling of comments in the thunking code should make the
differences in early and late environments more apparent.

Reported-by: Andy Lutomirski <luto@amacapital.net>
Tested-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2015-02-13 15:42:56 +00:00
..
alpha alpha/PCI: Clip bridge windows to fit in upstream windows 2015-01-16 10:04:42 -06:00
arc Minor updates for ARC for 3.19 2014-12-18 16:26:41 -08:00
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-01-27 13:55:36 -08:00
arm64 * Move efivarfs from the misc filesystem section to pseudo filesystem, 2015-01-29 19:16:40 +01:00
avr32 module_arch_freeing_init(): new hook for archs before module->module_init freed. 2015-01-20 11:38:32 +10:30
blackfin arch/blackfin/mach-bf533/boards/stamp.c: add linux/delay.h 2015-01-08 15:10:52 -08:00
c6x net, lib: kill arch_fast_hash library bits 2014-12-10 15:17:46 -05:00
cris Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-01-25 17:27:18 -08:00
frv frv/PCI: Clip bridge windows to fit in upstream windows 2015-01-16 10:04:42 -06:00
hexagon Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rkuo/linux-hexagon-kernel 2014-12-19 17:57:51 -08:00
ia64 PCI updates for v3.19: 2015-01-24 10:58:47 +12:00
m32r Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
m68k m68k: Wire up execveat 2015-01-11 11:14:14 +01:00
metag arch: Add lightweight memory barriers dma_rmb() and dma_wmb() 2014-12-11 21:15:06 -05:00
microblaze microblaze/PCI: Clip bridge windows to fit in upstream windows 2015-01-16 10:04:43 -06:00
mips module: remove mod arg from module_free, rename module_memfree(). 2015-01-20 11:38:33 +10:30
mn10300 mn10300/PCI: Clip bridge windows to fit in upstream windows 2015-01-16 10:04:43 -06:00
nios2 nios2 fixes for v3.19-rc6 2015-01-23 06:52:14 +12:00
openrisc net, lib: kill arch_fast_hash library bits 2014-12-10 15:17:46 -05:00
parisc Surprising number of fixes this merge window :( 2015-01-23 06:40:36 +12:00
powerpc Two powerpc fixes. 2015-01-27 10:04:38 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2015-01-23 06:53:06 +12:00
score net, lib: kill arch_fast_hash library bits 2014-12-10 15:17:46 -05:00
sh PM: Eliminate CONFIG_PM_RUNTIME 2014-12-19 22:55:06 +01:00
sparc PCI updates for v3.19: 2015-01-24 10:58:47 +12:00
tile module: remove mod arg from module_free, rename module_memfree(). 2015-01-20 11:38:33 +10:30
um um: Skip futex_atomic_cmpxchg_inatomic() test 2015-01-04 14:20:26 +01:00
unicore32 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
x86 x86/efi: Avoid triple faults during EFI mixed mode calls 2015-02-13 15:42:56 +00:00
xtensa Xtensa fixes for 3.19: 2014-12-16 14:08:53 -08:00
.gitignore
Kconfig