From df70d24c0beae19d40ff0b9f255e00f754e64b22 Mon Sep 17 00:00:00 2001 From: Xue Liu Date: Wed, 23 Oct 2024 16:16:47 +0800 Subject: [PATCH 1/2] Loongarch: Clear buffer for screen information and modify introduced old code --- ...uffer-to-zero-for-screen-information.patch | 40 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 1010-Clear-buffer-to-zero-for-screen-information.patch diff --git a/1010-Clear-buffer-to-zero-for-screen-information.patch b/1010-Clear-buffer-to-zero-for-screen-information.patch new file mode 100644 index 0000000..b2604e8 --- /dev/null +++ b/1010-Clear-buffer-to-zero-for-screen-information.patch @@ -0,0 +1,40 @@ +From 50a6f8e80cec46932e53a73563d02e7739d69400 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 23 Oct 2024 15:37:20 +0800 +Subject: [PATCH] Clear buffer to zero for screen information. Modify + introduced old code. + +--- + grub-core/kern/efi/mm.c | 2 +- + grub-core/loader/loongarch64/linux-elf.c | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 6f8810e..4281feb 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -469,7 +469,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + #ifdef GRUB_CPU_LOONGARCH64 + && desc->physical_start <= grub_efi_max_usable_address() + #else +- && desc->physical_start <= GRUB_EFI_MAX_USABLE_ADDRESS ++ && desc->physical_start <= GRUB_EFI_MAX_ALLOCATION_ADDRESS + #endif + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 + && desc->num_pages != 0) +diff --git a/grub-core/loader/loongarch64/linux-elf.c b/grub-core/loader/loongarch64/linux-elf.c +index bf3bfa4..34bfad7 100644 +--- a/grub-core/loader/loongarch64/linux-elf.c ++++ b/grub-core/loader/loongarch64/linux-elf.c +@@ -167,6 +167,8 @@ alloc_screen_info (void) + if (status != GRUB_EFI_SUCCESS) + return NULL; + ++ grub_memset((void *)si, 0, sizeof(struct screen_info)); ++ + status = b->install_configuration_table (&compat_screen_info_guid, si); + if (status != GRUB_EFI_SUCCESS) + goto free_mem; +-- +2.41.0 + diff --git a/grub.patches b/grub.patches index c6da383..c50ea16 100644 --- a/grub.patches +++ b/grub.patches @@ -207,3 +207,4 @@ Patch1007: 1007-CVE-2024-1048-grub-set-bootflag-Exit-calmly-when-not.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 +Patch1010: 1010-Clear-buffer-to-zero-for-screen-information.patch diff --git a/grub2.spec b/grub2.spec index 8cb21d1..ebef0a2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,4 +1,4 @@ -%define anolis_release 9 +%define anolis_release 10 %global _lto_cflags %{nil} %undefine _hardened_build @@ -506,6 +506,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 23 2024 Xue Liu - 2.12-10 +- Clear buffer for screen information +- Modify introduced old code + * Wed Jul 24 2024 Jun He - 2.12-9 - Updated cherry-picked NX patche series to fix setting memory attr failure -- Gitee From 7c4299fb0e0ea7a9a986977ead56afcbd41a4386 Mon Sep 17 00:00:00 2001 From: Xue Liu Date: Wed, 13 Nov 2024 15:27:11 +0800 Subject: [PATCH 2/2] Revert avoiding loongson-specified patches on other arches --- grub.macros | 2 +- grub2.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index 40d7fd7..72d6879 100644 --- a/grub.macros +++ b/grub.macros @@ -342,7 +342,7 @@ git add . \ git commit -a -q -m "%{tarversion} baseline." \ git am --whitespace=nowarn %%{patches} - 2.12-11 +- Revert avoiding loongson-specified patches on other arches + * Wed Oct 23 2024 Xue Liu - 2.12-10 - Clear buffer for screen information - Modify introduced old code -- Gitee