summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-03-11 19:17:11 +0100
committerSteve Sakoman <steve@sakoman.com>2025-03-15 06:40:08 -0700
commitf475700be6666a3a6f450dfc536b2d8a325623ee (patch)
treeaf14f6086f637a6326282ac10ed7d0f20ccb1223
parent8a84d05cedf19630917d3d58a074a2d9d506ba1e (diff)
downloadpoky-f475700be6666a3a6f450dfc536b2d8a325623ee.tar.gz
grup: patch CVE-2024-45781
Cherry-pick patch mentioning this CVE. (From OE-Core rev: 120d8cc7b91654557a3101a5f8fda44fb703e5b2) 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-45781.patch35
-rw-r--r--meta/recipes-bsp/grub/grub2.inc1
2 files changed, 36 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/CVE-2024-45781.patch b/meta/recipes-bsp/grub/files/CVE-2024-45781.patch
new file mode 100644
index 0000000000..bd0b6aa04a
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/CVE-2024-45781.patch
@@ -0,0 +1,35 @@
1From c1a291b01f4f1dcd6a22b61f1c81a45a966d16ba Mon Sep 17 00:00:00 2001
2From: B Horn <b@horn.uk>
3Date: Sun, 12 May 2024 02:03:33 +0100
4Subject: [PATCH 2/2] fs/ufs: Fix a heap OOB write
5
6grub_strcpy() was used to copy a symlink name from the filesystem
7image to a heap allocated buffer. This led to a OOB write to adjacent
8heap allocations. Fix by using grub_strlcpy().
9
10Fixes: CVE-2024-45781
11
12Reported-by: B Horn <b@horn.uk>
13Signed-off-by: B Horn <b@horn.uk>
14Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
15
16CVE: CVE-2024-45781
17Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=c1a291b01f4f1dcd6a22b61f1c81a45a966d16ba]
18Signed-off-by: Peter Marko <peter.marko@siemens.com>
19---
20 grub-core/fs/ufs.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
24index a354c92d9..01235101b 100644
25--- a/grub-core/fs/ufs.c
26+++ b/grub-core/fs/ufs.c
27@@ -463,7 +463,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
28 /* Check against zero is paylindromic, no need to swap. */
29 if (data->inode.nblocks == 0
30 && INODE_SIZE (data) <= sizeof (data->inode.symlink))
31- grub_strcpy (symlink, (char *) data->inode.symlink);
32+ grub_strlcpy (symlink, (char *) data->inode.symlink, sz);
33 else
34 {
35 if (grub_ufs_read_file (data, 0, 0, 0, sz, symlink) < 0)
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index f3279f7d2b..bace594ac4 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -20,6 +20,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
20 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ 20 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
21 file://0001-RISC-V-Restore-the-typcast-to-long.patch \ 21 file://0001-RISC-V-Restore-the-typcast-to-long.patch \
22 file://0001-misc-Implement-grub_strlcpy.patch \ 22 file://0001-misc-Implement-grub_strlcpy.patch \
23 file://CVE-2024-45781.patch \
23" 24"
24 25
25SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91" 26SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91"