diff --git a/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch new file mode 100644 index 00000000..fd68d092 --- /dev/null +++ b/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 26 May 2020 16:59:28 +0200 +Subject: [PATCH] x86-efi: Reduce maximum bounce buffer size to 16 MiB + +The EFI linux loader allocates a bounce buffer to copy the initrd since in +some machines doing DMA on addresses above 4GB is not possible during EFI. + +But the verifiers framework also allocates a buffer to copy the initrd in +its grub_file_open() handler. It does this since the data to verify has to +be passed as a single chunk to modules that use the verifiers framework. + +If the initrd image size is big there may not be enough memory in the heap +to allocate two buffers of that size. This causes an allocation failure in +the verifiers framework and leads to the initrd not being read. + +To prevent these allocation failures, let's reduce the maximum size of the +bounce buffer used in the EFI loader. Since the data read can be copied to +the actual initrd address in multilple chunks. + +Resolves: rhbz#1838633 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/loader/i386/efi/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 50b7798d6e5..e5b2736b0ce 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -144,7 +144,7 @@ grub_linuxefi_unload (void) + return GRUB_ERR_NONE; + } + +-#define BOUNCE_BUFFER_MAX 0x10000000ull ++#define BOUNCE_BUFFER_MAX 0x1000000ull + + static grub_ssize_t + read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len) diff --git a/grub.patches b/grub.patches index 58735cdf..22276ca6 100644 --- a/grub.patches +++ b/grub.patches @@ -216,3 +216,4 @@ Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch Patch0217: 0217-tpm-Enable-module-for-all-EFI-platforms.patch Patch0218: 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch +Patch0219: 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/grub2.spec b/grub2.spec index 172fd588..b3f9a0f6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 21%{?dist} +Release: 22%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue May 26 2020 Javier Martinez Canillas - 2.04-22 +- Fix an out of memory error when loading large initrd images + Resolves: rhbz#1838633 + * Wed May 20 2020 Javier Martinez Canillas - 2.04-21 - Don't update BLS files that aren't managed by GRUB scripts Resolves: rhbz#1837783