summaryrefslogtreecommitdiffstats
path: root/debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 03:22:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 03:22:57 +0000
commitd9960f3ed9eca14ab4a96327e3141d6f5911bb43 (patch)
tree4ccef5191aa34d62d8f385644be6e2dff0c8dea7 /debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch
parentMerging upstream version 6.1.85. (diff)
downloadlinux-d9960f3ed9eca14ab4a96327e3141d6f5911bb43.tar.xz
linux-d9960f3ed9eca14ab4a96327e3141d6f5911bb43.zip
Adding debian version 6.1.85-1.debian/6.1.85-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch')
-rw-r--r--debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch68
1 files changed, 0 insertions, 68 deletions
diff --git a/debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch b/debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch
deleted file mode 100644
index d5590f5db..000000000
--- a/debian/patches/bugfix/all/efi-libstub-fix-efi_random_alloc-to-allocate-memory-.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From: =?UTF-8?q?KONDO=20KAZUMA=28=E8=BF=91=E8=97=A4=E3=80=80=E5=92=8C?=
- =?UTF-8?q?=E7=9C=9F=29?= <kazuma-kondo@nec.com>
-Date: Fri, 22 Mar 2024 10:47:02 +0000
-Subject: efi/libstub: fix efi_random_alloc() to allocate memory at alloc_min
- or higher address
-Origin: https://git.kernel.org/linus/3cb4a4827596abc82e55b80364f509d0fefc3051
-
-Following warning is sometimes observed while booting my servers:
- [ 3.594838] DMA: preallocated 4096 KiB GFP_KERNEL pool for atomic allocations
- [ 3.602918] swapper/0: page allocation failure: order:10, mode:0xcc1(GFP_KERNEL|GFP_DMA), nodemask=(null),cpuset=/,mems_allowed=0-1
- ...
- [ 3.851862] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocation
-
-If 'nokaslr' boot option is set, the warning always happens.
-
-On x86, ZONE_DMA is small zone at the first 16MB of physical address
-space. When this problem happens, most of that space seems to be used by
-decompressed kernel. Thereby, there is not enough space at DMA_ZONE to
-meet the request of DMA pool allocation.
-
-The commit 2f77465b05b1 ("x86/efistub: Avoid placing the kernel below
-LOAD_PHYSICAL_ADDR") tried to fix this problem by introducing lower
-bound of allocation.
-
-But the fix is not complete.
-
-efi_random_alloc() allocates pages by following steps.
-1. Count total available slots ('total_slots')
-2. Select a slot ('target_slot') to allocate randomly
-3. Calculate a starting address ('target') to be included target_slot
-4. Allocate pages, which starting address is 'target'
-
-In step 1, 'alloc_min' is used to offset the starting address of memory
-chunk. But in step 3 'alloc_min' is not considered at all. As the
-result, 'target' can be miscalculated and become lower than 'alloc_min'.
-
-When KASLR is disabled, 'target_slot' is always 0 and the problem
-happens everytime if the EFI memory map of the system meets the
-condition.
-
-Fix this problem by calculating 'target' considering 'alloc_min'.
-
-Cc: linux-efi@vger.kernel.org
-Cc: Tom Englund <tomenglund26@gmail.com>
-Cc: linux-kernel@vger.kernel.org
-Fixes: 2f77465b05b1 ("x86/efistub: Avoid placing the kernel below LOAD_PHYSICAL_ADDR")
-Signed-off-by: Kazuma Kondo <kazuma-kondo@nec.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
----
- drivers/firmware/efi/libstub/randomalloc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/firmware/efi/libstub/randomalloc.c b/drivers/firmware/efi/libstub/randomalloc.c
-index 4e96a855fdf4..7e1852859550 100644
---- a/drivers/firmware/efi/libstub/randomalloc.c
-+++ b/drivers/firmware/efi/libstub/randomalloc.c
-@@ -120,7 +120,7 @@ efi_status_t efi_random_alloc(unsigned long size,
- continue;
- }
-
-- target = round_up(md->phys_addr, align) + target_slot * align;
-+ target = round_up(max(md->phys_addr, alloc_min), align) + target_slot * align;
- pages = size / EFI_PAGE_SIZE;
-
- status = efi_bs_call(allocate_pages, EFI_ALLOCATE_ADDRESS,
---
-2.43.0
-