1
0
Fork 0
remarkable-linux/drivers/firmware/efi
Ard Biesheuvel 7fd683812e efi/esrt: Only call efi_mem_reserve() for boot services memory
[ Upstream commit 61f0d55569 ]

The following commit:

  7e1550b8f2 ("efi: Drop type and attribute checks in efi_mem_desc_lookup()")

refactored the implementation of efi_mem_desc_lookup() so that the type
check is moved to the callers, one of which is the x86 version of
efi_arch_mem_reserve(), where we added a modified check that only takes
EFI_BOOT_SERVICES_DATA regions into account.

This is reasonable, since it is the only memory type that requires this,
but doing so uncovered some unexpected behavior in the ESRT code, which
permits the ESRT table to reside in other types of memory than what the
UEFI spec mandates (i.e., EFI_BOOT_SERVICES_DATA), and unconditionally
calls efi_mem_reserve() on the region in question. This may result in
errors such as

  esrt: Reserving ESRT space from 0x000000009c810318 to 0x000000009c810350.
  efi: Failed to lookup EFI memory descriptor for 0x000000009c810318

when the ESRT table is not in EFI_BOOT_SERVICES_DATA memory, but we try
to reserve it nonetheless.

So make the call to efi_mem_reserve() conditional on the memory type.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Jones <pjones@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:10 +02:00
..
libstub efi/libstub/arm64: Handle randomized TEXT_OFFSET 2018-06-21 04:03:01 +09:00
test License cleanup: add SPDX license identifiers to some files 2017-11-02 10:04:46 -07:00
Kconfig x86/efi: Clarify that reset attack mitigation needs appropriate userspace 2018-02-03 17:39:25 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
apple-properties.c treewide: Consolidate Apple DMI checks 2017-08-03 23:26:22 +02:00
arm-init.c efi/arm: preserve early mapping of UEFI memory map longer for BGRT 2018-09-26 08:38:04 +02:00
arm-runtime.c efi/arm: preserve early mapping of UEFI memory map longer for BGRT 2018-09-26 08:38:04 +02:00
capsule-loader.c efi/capsule-loader: Reinstate virtual capsule mapping 2018-01-10 09:31:18 +01:00
capsule.c efi/capsule-loader: Use page addresses rather than struct page pointers 2017-06-05 17:50:41 +02:00
cper.c Just a single conversion to the new UUID API for this merge window. 2017-09-12 13:27:21 -07:00
dev-path-parser.c efi: Add device path parser 2016-11-13 08:23:15 +01:00
efi-bgrt.c efi/bgrt: Use efi_mem_type() 2017-08-26 09:20:33 +02:00
efi-pstore.c pstore: Populate pstore record->time field 2017-05-31 10:13:44 -07:00
efi.c efi: Move some sysfs files to be read-only by root 2017-12-14 09:52:52 +01:00
efibc.c efibc: Report more information in the error messages 2016-06-27 13:06:54 +02:00
efivars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00
esrt.c efi/esrt: Only call efi_mem_reserve() for boot services memory 2018-09-26 08:38:10 +02:00
fake_mem.c x86/efi: Don't allocate memmap through memblock after mm_init() 2017-01-07 08:58:07 +01:00
memattr.c x86/efi: Add support for EFI_MEMORY_ATTRIBUTES_TABLE 2017-02-01 08:45:44 +01:00
memmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reboot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
runtime-map.c efi: Move some sysfs files to be read-only by root 2017-12-14 09:52:52 +01:00
runtime-wrappers.c efi: Replace runtime services spinlock with semaphore 2016-09-09 16:08:43 +01:00
vars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00