[PATCH Trusty SRU] x86/efi: Fix boot failure with EFI stub

Tim Gardner tim.gardner at canonical.com
Mon Jul 18 14:22:25 UTC 2016


From: Matt Fleming <matt.fleming at intel.com>

BugLink: http://bugs.launchpad.net/bugs/1603476

commit 54b52d872680 ("x86/efi: Build our own EFI services pointer
table") introduced a regression because the 64-bit file_size()
implementation passed a pointer to a 32-bit data object, instead of a
pointer to a 64-bit object.

Because the firmware treats the object as 64-bits regardless it was
reading random values from the stack for the upper 32-bits.

This resulted in people being unable to boot their machines, after
seeing the following error messages,

    Failed to get file info size
    Failed to alloc highmem for files

Reported-by: Dzmitry Sledneu <dzmitry.sledneu at gmail.com>
Reported-by: Koen Kooi <koen at dominion.thruhere.net>
Tested-by: Koen Kooi <koen at dominion.thruhere.net>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
(cherry picked from commit 396f1a08db212138418b38f784e4bbe516d2fdb2)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
 arch/x86/boot/compressed/eboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 309760a..8571bd8 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -57,7 +57,7 @@ efi_file_size(efi_system_table_t *sys_table, void *__fh,
 	efi_file_info_t *info;
 	efi_status_t status;
 	efi_guid_t info_guid = EFI_FILE_INFO_ID;
-	u32 info_sz;
+	u64 info_sz;
 
 	status = efi_early->call((unsigned long)fh->open, fh, &h, filename_16,
 				 EFI_FILE_MODE_READ, (u64)0);
-- 
1.9.1





More information about the kernel-team mailing list