summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-03-11 19:14:19 +0100
committerSteve Sakoman <steve@sakoman.com>2025-03-15 06:44:47 -0700
commitbce8588104de7b12e3cf94ba051da91052741e1c (patch)
treecf84cce16e187985175bdf9c1bc0cf7f40bc3048
parentc9c5246e9f9c5b9920a5af0204785dbb1ef81a3c (diff)
downloadpoky-bce8588104de7b12e3cf94ba051da91052741e1c.tar.gz
grub: patch CVE-2024-45777
Cherry-pick patch mentioning this CVE. (From OE-Core rev: bfebaeb1705d072eb6b42a6dfe9bff4829a49a33) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-bsp/grub/files/CVE-2024-45777.patch57
-rw-r--r--meta/recipes-bsp/grub/grub2.inc1
2 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/CVE-2024-45777.patch b/meta/recipes-bsp/grub/files/CVE-2024-45777.patch
new file mode 100644
index 0000000000..0305a95fd5
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/CVE-2024-45777.patch
@@ -0,0 +1,57 @@
1From b970a5ed967816bbca8225994cd0ee2557bad515 Mon Sep 17 00:00:00 2001
2From: Lidong Chen <lidong.chen@oracle.com>
3Date: Fri, 22 Nov 2024 06:27:57 +0000
4Subject: [PATCH] gettext: Integer overflow leads to heap OOB write
5
6The size calculation of the translation buffer in
7grub_gettext_getstr_from_position() may overflow
8to 0 leading to heap OOB write. This patch fixes
9the issue by using grub_add() and checking for
10an overflow.
11
12Fixes: CVE-2024-45777
13
14Reported-by: Nils Langius <nils@langius.de>
15Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
16Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
17Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
18
19CVE: CVE-2024-45777
20Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=b970a5ed967816bbca8225994cd0ee2557bad515]
21Signed-off-by: Peter Marko <peter.marko@siemens.com>
22---
23 grub-core/gettext/gettext.c | 7 ++++++-
24 1 file changed, 6 insertions(+), 1 deletion(-)
25
26diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
27index 63bb1ab73..9ffc73428 100644
28--- a/grub-core/gettext/gettext.c
29+++ b/grub-core/gettext/gettext.c
30@@ -26,6 +26,7 @@
31 #include <grub/file.h>
32 #include <grub/kernel.h>
33 #include <grub/i18n.h>
34+#include <grub/safemath.h>
35
36 GRUB_MOD_LICENSE ("GPLv3+");
37
38@@ -99,6 +100,7 @@ grub_gettext_getstr_from_position (struct grub_gettext_context *ctx,
39 char *translation;
40 struct string_descriptor desc;
41 grub_err_t err;
42+ grub_size_t alloc_sz;
43
44 internal_position = (off + position * sizeof (desc));
45
46@@ -109,7 +111,10 @@ grub_gettext_getstr_from_position (struct grub_gettext_context *ctx,
47 length = grub_cpu_to_le32 (desc.length);
48 offset = grub_cpu_to_le32 (desc.offset);
49
50- translation = grub_malloc (length + 1);
51+ if (grub_add (length, 1, &alloc_sz))
52+ return NULL;
53+
54+ translation = grub_malloc (alloc_sz);
55 if (!translation)
56 return NULL;
57
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index 581855eb4b..b67b7d2e16 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -30,6 +30,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
30 file://CVE-2025-0622-02.patch \ 30 file://CVE-2025-0622-02.patch \
31 file://CVE-2025-0622-03.patch \ 31 file://CVE-2025-0622-03.patch \
32 file://CVE-2024-45776.patch \ 32 file://CVE-2024-45776.patch \
33 file://CVE-2024-45777.patch \
33" 34"
34 35
35SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91" 36SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91"