diff --git a/1013-Use-proper-memory-type-for-kernel-allocation.patch b/1013-Use-proper-memory-type-for-kernel-allocation.patch new file mode 100644 index 0000000000000000000000000000000000000000..303f07d03125a1565791d22c0c5e86eebd229eee --- /dev/null +++ b/1013-Use-proper-memory-type-for-kernel-allocation.patch @@ -0,0 +1,42 @@ +From c6374000b7bd0370f084cafd7f8991dc99e18fd6 Mon Sep 17 00:00:00 2001 +From: yechao-w +Date: Mon, 26 May 2025 18:29:49 -0400 +Subject: [PATCH] Use proper memory type for kernel allocation + +commit 41b68c337b68333898afb65714c709ef upstream +Signed-off-by: Maximilian Luz + +[yechao-w: Adjust the patch to adapt to branch a23] +Signed-off-by: yechao-w +--- + grub-core/loader/efi/linux.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 7447c5b..c8e8de1 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -25,6 +25,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -622,7 +624,10 @@ fallback: + grub_loader_unset(); + + grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); +- kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); ++ kernel_addr = grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS, ++ GRUB_EFI_BYTES_TO_PAGES (kernel_size), ++ GRUB_EFI_ALLOCATE_MAX_ADDRESS, ++ GRUB_EFI_LOADER_CODE); + grub_dprintf ("linux", "kernel numpages: %lld\n", + (long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size)); + if (!kernel_addr) +-- +2.18.1 + diff --git a/grub.patches b/grub.patches index 88a169ad03f26e1f3aafb6781420d487a4145493..117689f0845dcf36c4fdd8f119dd90e0a1a84b2d 100644 --- a/grub.patches +++ b/grub.patches @@ -206,6 +206,7 @@ Patch1006: 1006-CVE-2024-1048-grub-set-bootflag-More-complete-fix.patch Patch1007: 1007-CVE-2024-1048-grub-set-bootflag-Exit-calmly-when-not.patch Patch1010: 1010-cryptodisk-add-OS-provided-secret-support.patch Patch1011: 1011-efi-Add-API-for-retrieving-the-EFI-secret-for-crypto.patch +Patch1013: 1013-Use-proper-memory-type-for-kernel-allocation.patch Patch1004: 1004-Revert-Add-support-for-Linux-EFI-stub-loading.patch Patch1008: 1008-loongarch-add-back-compatibility-for-linux-kernel.patch Patch1009: 1009-configure-Add-GRUB_CPU_LOONGARCH64-support.patch diff --git a/grub2.spec b/grub2.spec index d3070f389717924fd08f7054567bfe2f61da36e4..72d3e9b313185e58346aa6da8ef728e54f9f8e41 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,4 +1,4 @@ -%define anolis_release 11 +%define anolis_release 12 %global _lto_cflags %{nil} %undefine _hardened_build @@ -506,6 +506,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri May 30 2025 yechao-w - 2.12-12 +- Use proper memory type for kernel allocation + * Tue Jan 14 2025 Xue Liu - 2.12-11 - Fix the introduced old code - Clear buffer for screen information