From 52ed96a0e9538a6af7618df42993dde9e683048d Mon Sep 17 00:00:00 2001 From: Qiumiao Zhang Date: Tue, 8 Apr 2025 01:57:45 +0000 Subject: [PATCH] fix CVE-2024-56738 Signed-off-by: Qiumiao Zhang --- backport-fix-CVE-2024-56738.patch | 42 +++++++++++++++++++++++++++++++ grub.patches | 2 +- grub2.spec | 8 +++++- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 backport-fix-CVE-2024-56738.patch diff --git a/backport-fix-CVE-2024-56738.patch b/backport-fix-CVE-2024-56738.patch new file mode 100644 index 0000000..6ede75f --- /dev/null +++ b/backport-fix-CVE-2024-56738.patch @@ -0,0 +1,42 @@ +From 8b1b47efd667ea3450681fa0c674045980e25360 Mon Sep 17 00:00:00 2001 +From: Jonathan Bar Or +Date: Mon, 7 Apr 2025 09:36:34 +0000 +Subject: [PATCH] fix CVE-2024-56738 + +Reference:https://savannah.gnu.org/bugs/?66603 +Conflict:NA + +--- + grub-core/lib/crypto.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c +index d53ddbe..653aab7 100644 +--- a/grub-core/lib/crypto.c ++++ b/grub-core/lib/crypto.c +@@ -440,16 +440,16 @@ grub_crypto_gcry_error (gcry_err_code_t in) + int + grub_crypto_memcmp (const void *a, const void *b, grub_size_t n) + { +- register grub_size_t counter = 0; +- const grub_uint8_t *pa, *pb; ++ register grub_uint8_t indicator = 0; ++ const grub_uint8_t *pa = a, *pb = b; ++ grub_size_t i; + +- for (pa = a, pb = b; n; pa++, pb++, n--) ++ for (i = 0; i < n; i++) + { +- if (*pa != *pb) +- counter++; ++ indicator |= (pa[i] ^ pb[i]); + } + +- return !!counter; ++ return !!indicator; + } + + #ifndef GRUB_UTIL +-- +2.33.0 + diff --git a/grub.patches b/grub.patches index 299c9be..d3b8426 100644 --- a/grub.patches +++ b/grub.patches @@ -440,4 +440,4 @@ Patch0439: backport-0079-kern-partition-Add-sanity-check-after-grub_strtoul-c.pa Patch0440: backport-0080-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch Patch0441: backport-0081-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch Patch0442: backport-0082-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch - +Patch0443: backport-fix-CVE-2024-56738.patch diff --git a/grub2.spec b/grub2.spec index 708e18e..7e3d9be 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 51 +Release: 52 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -453,6 +453,12 @@ fi %{_datadir}/man/man* %changelog +* Tue Apr 8 2025 zhangqiumiao - 1:2.06-52 +- Type:CVE +- CVE:CVE-2024-56738 +- SUG:NA +- DESC:fix CVE-2024-56738 + * Tue Feb 25 2025 sunhai - 1:2.06-51 - Type:CVE - CVE:CVE-2024-45781,CVE-2024-45782,CVE-2024-56737,CVE-2024-45780,CVE-2024-45783,CVE-2024-49504,CVE-2025-0624,CVE-20 -- Gitee