Wed 23 May 2012 07:33:10 PM UTC, original submission:
Grub v 1.99 is failing to boot on certain systems in EFI mode.
This was discovered on some Dell 12G server systems (the PowerEdge R720, for example), using Ubuntu 12.04, but the issue was reproduced with vanilla grub 1.99. Some systems will boot under certain circumstances (I have one R720 that will boot if I hit "F11" to go into a UEFI boot menu and then boot, but not if the system tries to boot with no manual intervention), other systems will not boot at all.
The problem is that grub2 is failing to get the EFI memory map in grub-core/loader/i386/linux.c, when it calls grub_efi_finish_boot_services(), because the buffer it allocated for the EFI memory map earlier in allocate_pages() (in the same file) is not big enough. (The EFI memory map has grown considerably--like 50000 bytes or so--between the time that the efi_mmap_buf was set up in allocate_pages() and the time it is used in grub_efi_finish_boot_services()).
When allocate_pages() runs, it really has no way to know how large the EFI memory map will be when it needs that buffer. Also, the EFI memory map does not need to be at an address under 1MB, either.
I've made a patch that modifies allocate_pages() so that it no longer allocates a buffer for the EFI memory map. Instead, the buffer is allocated right before the call to grub_efi_finish_boot_services() in grub-linux_boot(), and it tries to put it at the top of memory (or just below the initrd, if one is loaded).
I have verified that this fixes the issue on my systems.
I'm attaching the patch.
|