|
|
b9d01e |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
b9d01e |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
b9d01e |
Date: Tue, 26 May 2020 16:59:28 +0200
|
|
|
b9d01e |
Subject: [PATCH] x86-efi: Reduce maximum bounce buffer size to 16 MiB
|
|
|
b9d01e |
|
|
|
b9d01e |
The EFI linux loader allocates a bounce buffer to copy the initrd since in
|
|
|
b9d01e |
some machines doing DMA on addresses above 4GB is not possible during EFI.
|
|
|
b9d01e |
|
|
|
b9d01e |
But the verifiers framework also allocates a buffer to copy the initrd in
|
|
|
b9d01e |
its grub_file_open() handler. It does this since the data to verify has to
|
|
|
b9d01e |
be passed as a single chunk to modules that use the verifiers framework.
|
|
|
b9d01e |
|
|
|
b9d01e |
If the initrd image size is big there may not be enough memory in the heap
|
|
|
b9d01e |
to allocate two buffers of that size. This causes an allocation failure in
|
|
|
b9d01e |
the verifiers framework and leads to the initrd not being read.
|
|
|
b9d01e |
|
|
|
b9d01e |
To prevent these allocation failures, let's reduce the maximum size of the
|
|
|
b9d01e |
bounce buffer used in the EFI loader. Since the data read can be copied to
|
|
|
b9d01e |
the actual initrd address in multilple chunks.
|
|
|
b9d01e |
|
|
|
b9d01e |
Resolves: rhbz#1838633
|
|
|
b9d01e |
|
|
|
b9d01e |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
b9d01e |
(cherry picked from commit 1c0d2ebdddf69962395f0fa4578446654512f3c4)
|
|
|
b9d01e |
---
|
|
|
b9d01e |
grub-core/loader/i386/efi/linux.c | 2 +-
|
|
|
b9d01e |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
b9d01e |
|
|
|
b9d01e |
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
|
|
b9d01e |
index e9d2c85b3..a043df891 100644
|
|
|
b9d01e |
--- a/grub-core/loader/i386/efi/linux.c
|
|
|
b9d01e |
+++ b/grub-core/loader/i386/efi/linux.c
|
|
|
b9d01e |
@@ -146,7 +146,7 @@ grub_linuxefi_unload (void)
|
|
|
b9d01e |
return GRUB_ERR_NONE;
|
|
|
b9d01e |
}
|
|
|
b9d01e |
|
|
|
b9d01e |
-#define BOUNCE_BUFFER_MAX 0x10000000ull
|
|
|
b9d01e |
+#define BOUNCE_BUFFER_MAX 0x1000000ull
|
|
|
b9d01e |
|
|
|
b9d01e |
static grub_ssize_t
|
|
|
b9d01e |
read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len)
|