diff --git a/1012-Use-proper-memory-type-for-kernel-allocation.patch b/1012-Use-proper-memory-type-for-kernel-allocation.patch new file mode 100644 index 0000000000000000000000000000000000000000..38320c48f9d4677fefbe653af4393b80d62fad4f --- /dev/null +++ b/1012-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.2] +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 7c190ae14811f2730127d4be72274ef01ea45e9e..bd1ebc3c68d87dcf95f75eaaf28fa9a0aeac978f 100644 --- a/grub.patches +++ b/grub.patches @@ -204,6 +204,7 @@ Patch1003: 0002-newfeature-tpcm-embed-tpcm-module-into-kernel.img-by.patch Patch1005: 1005-CVE-2024-1048-grub-set-bootflag-Conservative-partial-fix.patch 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 +Patch1012: 1012-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 82330bc674d09fc13a3d1ee872e3ed275c0c463a..ff5f2aa0e88cd956dc0f4684919cd279619a7aa3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,4 +1,4 @@ -%define anolis_release 12 +%define anolis_release 13 %global _lto_cflags %{nil} %undefine _hardened_build @@ -506,6 +506,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue May 27 2025 yechao-w - 2.12-13 +- Use proper memory type for kernel allocation + * Thu Mar 13 2025 Huang Yang - 2.12-12 - In package grub2-efi-loongarch64, provide grub2