History

efi/x86: Prune invalid memory map entries and fix boot regression

Some machines, such as the Lenovo ThinkPad W541 with firmware GNET80WW (2.28), include memory map entries with phys_addr=0x0 and num_pages=0. These machines fail to boot after the following commit, commit 8e80632fb23f ("efi/esrt: Use efi_mem_reserve() and avoid a kmalloc()") Fix this by removing such bogus entries from the memory map. Furthermore, currently the log output for this case (with efi=debug) looks like: [ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0xffffffffffffffff] (0MB) This is clearly wrong, and also not as informative as it could be. This patch changes it so that if we find obviously invalid memory map entries, we print an error and skip those entries. It also detects the display of the address range calculation overflow, so the new output is: [ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries: [ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0x0000000000000000] (invalid) It also detects memory map sizes that would overflow the physical address, for example phys_addr=0xfffffffffffff000 and num_pages=0x0200000000000001, and prints: [ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries: [ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[phys_addr=0xfffffffffffff000-0x20ffffffffffffffff] (invalid) It then removes these entries from the memory map.

Peter Jones committed 9 years ago

Commit 0100a3e1 parent 20b1e222 files · +67 −0Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/efi.h+1−0
@@ -103,6 +103,7 @@ typedef struct { · 102 unmodified lines
103 103
104#define EFI_PAGE_SHIFT 12104#define EFI_PAGE_SHIFT 12
105#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)105#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
106#define EFI_PAGES_MAX (U64_MAX >> EFI_PAGE_SHIFT)
106 107
107typedef struct {108typedef struct {
108 u32 type;109 u32 type;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t