Re: Loading initrd above 4G causes freeze on boot

From: Yinghai Lu
Date: Sun Aug 10 2014 - 01:55:25 EST


On Sat, Aug 9, 2014 at 3:45 PM, Mantas MikulÄnas <grawity@xxxxxxxxx> wrote:
> On Sat, Aug 9, 2014 at 10:23 PM, Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote:
> [However... Whether it's five chunks, four (after making the initrd
> smaller), or just one (with your efi=nochunk), I noticed that it
> *always* hangs during the *last* read, and the allocated memory always
> ends at roughly the same address (0x137fffXXX). I wonder if it's
> selecting a memory location already in use, or something like that...]
>
> (The laptop is Asus K52JT, AMI firmware v206, no updates available.)

wonder if efi_file_read return with wrong chunksize.

Can you try attached patch ?

Thanks

Yinghai
---
drivers/firmware/efi/libstub/efi-stub-helper.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/firmware/efi/libstub/efi-stub-helper.c
===================================================================
--- linux-2.6.orig/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ linux-2.6/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -431,7 +431,8 @@ efi_status_t handle_cmdline_files(efi_sy
status = efi_file_read(files[j].handle,
&chunksize,
(void *)addr);
- if (status != EFI_SUCCESS) {
+ if (status != EFI_SUCCESS ||
+ chunksize > size || !chunksize) {
pr_efi_err(sys_table_arg, "Failed to read file\n");
goto free_file_total;
}