mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 06:22:43 +00:00
Fix an out of memory error when loading large initrd images
Resolves: rhbz#1838633 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
7fb7a6a7a5
commit
098a8a9e99
3 changed files with 46 additions and 1 deletions
|
@ -0,0 +1,40 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
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 <javierm@redhat.com>
|
||||
---
|
||||
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)
|
|
@ -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
|
||||
|
|
|
@ -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 <javierm@redhat.com> - 2.04-22
|
||||
- Fix an out of memory error when loading large initrd images
|
||||
Resolves: rhbz#1838633
|
||||
|
||||
* Wed May 20 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-21
|
||||
- Don't update BLS files that aren't managed by GRUB scripts
|
||||
Resolves: rhbz#1837783
|
||||
|
|
Loading…
Reference in a new issue