From 9ec139058fbdc2c7ad26e5989131db85edcaa643 Mon Sep 17 00:00:00 2001 From: Xue Liu Date: Tue, 14 Jan 2025 15:54:02 +0800 Subject: [PATCH] loongarch: clear buffer for screen information and fix the 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 1012-Clear-buffer-to-zero-for-screen-information.patch diff --git a/1012-Clear-buffer-to-zero-for-screen-information.patch b/1012-Clear-buffer-to-zero-for-screen-information.patch new file mode 100644 index 0000000..b2604e8 --- /dev/null +++ b/1012-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 07c4dd1..0d70185 100644 --- a/grub.patches +++ b/grub.patches @@ -209,3 +209,4 @@ Patch1008: 1008-loongarch-add-back-compatibility-for-linux-kernel.patch Patch1009: 1009-configure-Add-GRUB_CPU_LOONGARCH64-support.patch Patch1010: 1010-cryptodisk-add-OS-provided-secret-support.patch Patch1011: 1011-efi-Add-API-for-retrieving-the-EFI-secret-for-crypto.patch +Patch1012: 1012-Clear-buffer-to-zero-for-screen-information.patch diff --git a/grub2.spec b/grub2.spec index 6ecafb3..d3070f3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,4 +1,4 @@ -%define anolis_release 10 +%define anolis_release 11 %global _lto_cflags %{nil} %undefine _hardened_build @@ -506,6 +506,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 14 2025 Xue Liu - 2.12-11 +- Fix the introduced old code +- Clear buffer for screen information + * Thu Jan 02 2025 hanliyang - 2.12-10 - Support use confidential computing provisioned secrets for disk decryption -- Gitee