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