android_kernel_motorola_sm6225/arch/x86
Dave Young fa03b9cab9 x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage
[ Upstream commit af164898482817a1d487964b68f3c21bae7a1beb ]

Michael Weiser reported that he got this error during a kexec rebooting:

  esrt: Unsupported ESRT version 2904149718861218184.

The ESRT memory stays in EFI boot services data, and it was reserved
in kernel via efi_mem_reserve().  The initial purpose of the reservation
is to reuse the EFI boot services data across kexec reboot. For example
the BGRT image data and some ESRT memory like Michael reported.

But although the memory is reserved it is not updated in the X86 E820 table,
and kexec_file_load() iterates system RAM in the IO resource list to find places
for kernel, initramfs and other stuff. In Michael's case the kexec loaded
initramfs overwrote the ESRT memory and then the failure happened.

Since kexec_file_load() depends on the E820 table being updated, just fix this
by updating the reserved EFI boot services memory as reserved type in E820.

Originally any memory descriptors with EFI_MEMORY_RUNTIME attribute are
bypassed in the reservation code path because they are assumed as reserved.

But the reservation is still needed for multiple kexec reboots,
and it is the only possible case we come here thus just drop the code
chunk, then everything works without side effects.

On my machine the ESRT memory sits in an EFI runtime data range, it does
not trigger the problem, but I successfully tested with BGRT instead.
both kexec_load() and kexec_file_load() work and kdump works as well.

[ mingo: Edited the changelog. ]

Reported-by: Michael Weiser <michael@weiser.dinsnail.net>
Tested-by: Michael Weiser <michael@weiser.dinsnail.net>
Signed-off-by: Dave Young <dyoung@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kexec@lists.infradead.org
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191204075233.GA10520@dhcp-128-65.nay.redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:17:06 +01:00
..
boot x86/boot/compressed/64: Fix missing initialization in find_trampoline_placement() 2019-09-10 10:33:53 +01:00
configs
crypto crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest() 2019-05-22 07:37:37 +02:00
entry x86/entry/64: Use JMP instead of JMPQ 2019-08-06 19:06:58 +02:00
events perf/x86/intel/bts: Fix the use of page_private() 2020-01-09 10:19:09 +01:00
hyperv x86/hyperv: Suppress "PCI: Fatal: No config space access function found" 2019-11-20 18:47:43 +01:00
ia32 x86/ia32: Fix ia32_restore_sigcontext() AC leak 2019-05-31 06:46:27 -07:00
include x86/crash: Add a forward declaration of struct kimage 2019-12-31 16:36:02 +01:00
kernel x86/mce: Fix possibly incorrect severity calculation on AMD 2020-01-04 19:13:19 +01:00
kvm KVM: x86: fix out-of-bounds write in KVM_GET_EMULATED_CPUID (CVE-2019-19332) 2019-12-13 08:52:58 +01:00
lib x86/insn: Add some Intel instructions to the opcode map 2019-12-31 16:36:08 +01:00
math-emu x86: math-emu: Hide clang warnings for 16-bit overflow 2019-08-06 19:06:51 +02:00
mm x86/mm: Use the correct function type for native_set_fixmap() 2019-12-31 16:35:12 +01:00
net bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE} 2019-11-24 08:19:17 +01:00
oprofile x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() 2018-02-21 09:54:17 +01:00
pci x86/PCI: Avoid AMD FCH XHCI USB PME# from D0 defect 2019-12-13 08:52:40 +01:00
platform x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage 2020-01-12 12:17:06 +01:00
power PM / hibernate: Check the success of generating md5 digest before hibernation 2019-11-24 08:19:56 +01:00
purgatory x86/purgatory: Disable the stackleak GCC plugin for the purgatory 2019-10-11 18:21:18 +02:00
ras
realmode x86/realmode: Don't leak the trampoline kernel address 2019-05-04 09:20:21 +02:00
tools x86/insn: Fix awk regexp warnings 2019-12-01 09:17:37 +01:00
um um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP 2018-11-21 09:19:16 +01:00
video
xen kprobes/x86/xen: blacklist non-attachable xen interrupt functions 2019-12-05 09:20:25 +01:00
.gitignore x86/build: Add arch/x86/tools/insn_decoder_test to .gitignore 2018-02-13 14:10:29 +01:00
Kbuild
Kconfig x86/olpc: Fix build error with CONFIG_MFD_CS5535=m 2019-11-24 08:20:30 +01:00
Kconfig.cpu Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-03-25 07:36:02 -10:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning 2019-09-19 09:09:41 +02:00
Makefile.um kbuild: rename LDFLAGS to KBUILD_LDFLAGS 2018-08-24 08:22:08 +09:00
Makefile_32.cpu