This patch brings the entire stack of Debian patches on grub2 titled
"cve-2025-jan" and available at:
https://salsa.debian.org/grub-team/grub/-/tree/debian/2.12-9/debian/patches/cve-2025-jan?ref_type=tags
As of this exact Debian grub2 version 2.12-9. Some minor conflicts had
to be fixed. All patches are in upstream Grub master, but mixed with
hundreds of other changes, which is why Debian's effort to backport
them has been leveraged here.
In addition to those patches, 2 extra patches are added:
0073-net-drivers-ieee1275-ofnet-Add-missing-grub_malloc.patch
0074-Constant-time-grub_crypto_memcmp.patch
The first one fixes an issue in one of the earlier patches. The fix is
not in Debian, but is in upstream Grub.
The second one fixes another CVE, not fixed in Debian, but fixed in
OpenSUSE. This fix is not upstream as upstream has decided to move to
libgcrypt instead to avoid the problem, but that's a fairly large
change.
Overall, this patch fixes all CVEs currently reported by pkg-stats
against our grub2 package, namely:
CVE-2024-45777
CVE-2024-45778
CVE-2024-45779
CVE-2024-45780
CVE-2024-45782
CVE-2024-56737
CVE-2024-56738
CVE-2025-0678
CVE-2025-0684
CVE-2025-0685
CVE-2025-0686
CVE-2025-0689
CVE-2025-1125
With the previous fixes on runtime tests added (to use glibc
toolchains to build grub2 tests), this commit successfully passes all
tests:
- The ISO9660 tests that use grub2:
https://gitlab.com/tpetazzoni/buildroot/-/pipelines/1985234563
- The grub2 tests:
https://gitlab.com/tpetazzoni/buildroot/-/pipelines/1985234685
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Julien: also tested by building and booting
- qemu_aarch64_sbsa_defconfig
- qemu_arm_ebbr_defconfig
- qemu_loongarch64_virt_efi_defconfig
- qemu_riscv64_virt_efi_defconfig
- pc_x86_64_bios_defconfig
- pc_x86_64_efi_defconfig
]
Tested-by: Julien Olivain <ju.o@free.fr>
[Julien:
- fix patch #72 upstream link to point to the initial patch
sumbission rather than a reply
- merge two _IGNORE_CVES blocks for patch #50 into a single one
- order _IGNORE_CVES blocks by numerical patch order
- order numerically the CVE list in commit log
- add a "Fixes:" tag in patch #74 since its commit log does not
mention the CVE.
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit ded3e0045a)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
91 lines
2.8 KiB
Diff
91 lines
2.8 KiB
Diff
From 32f319d100c3b8f9b04e6a175f599c7411a54555 Mon Sep 17 00:00:00 2001
|
|
From: Lidong Chen <lidong.chen@oracle.com>
|
|
Date: Mon, 16 Dec 2024 20:22:40 +0000
|
|
Subject: [PATCH] fs/jfs: Inconsistent signed/unsigned types usage in return
|
|
values
|
|
|
|
The getblk() returns a value of type grub_int64_t which is assigned to
|
|
iagblk and inoblk, both of type grub_uint64_t, in grub_jfs_read_inode()
|
|
via grub_jfs_blkno(). This patch fixes the type mismatch in the
|
|
functions. Additionally, the getblk() will return 0 instead of -1 on
|
|
failure cases. This change is safe because grub_errno is always set in
|
|
getblk() to indicate errors and it is later checked in the callers.
|
|
|
|
Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
|
|
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
|
|
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
Upstream: edd995a26ec98654d907a9436a296c2d82bc4b28
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
---
|
|
grub-core/fs/jfs.c | 15 +++++++++------
|
|
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c
|
|
index 2bde48d45..70a2f4947 100644
|
|
--- a/grub-core/fs/jfs.c
|
|
+++ b/grub-core/fs/jfs.c
|
|
@@ -279,7 +279,7 @@ get_ext_offset (grub_uint8_t offset1, grub_uint32_t offset2)
|
|
return (((grub_uint64_t) offset1 << 32) | grub_le_to_cpu32 (offset2));
|
|
}
|
|
|
|
-static grub_int64_t
|
|
+static grub_uint64_t
|
|
getblk (struct grub_jfs_treehead *treehead,
|
|
struct grub_jfs_tree_extent *extents,
|
|
int max_extents,
|
|
@@ -290,6 +290,8 @@ getblk (struct grub_jfs_treehead *treehead,
|
|
int i;
|
|
grub_uint64_t ext_offset, ext_blk;
|
|
|
|
+ grub_errno = GRUB_ERR_NONE;
|
|
+
|
|
for (i = 0; i < grub_le_to_cpu16 (treehead->count) - 2 &&
|
|
i < max_extents; i++)
|
|
{
|
|
@@ -312,7 +314,7 @@ getblk (struct grub_jfs_treehead *treehead,
|
|
|
|
if (found != -1)
|
|
{
|
|
- grub_int64_t ret = -1;
|
|
+ grub_uint64_t ret = 0;
|
|
struct
|
|
{
|
|
struct grub_jfs_treehead treehead;
|
|
@@ -321,7 +323,7 @@ getblk (struct grub_jfs_treehead *treehead,
|
|
|
|
tree = grub_zalloc (sizeof (*tree));
|
|
if (!tree)
|
|
- return -1;
|
|
+ return 0;
|
|
|
|
if (!grub_disk_read (data->disk,
|
|
(grub_disk_addr_t) ext_blk
|
|
@@ -334,19 +336,20 @@ getblk (struct grub_jfs_treehead *treehead,
|
|
else
|
|
{
|
|
grub_error (GRUB_ERR_BAD_FS, "jfs: infinite recursion detected");
|
|
- ret = -1;
|
|
+ ret = 0;
|
|
}
|
|
}
|
|
grub_free (tree);
|
|
return ret;
|
|
}
|
|
|
|
- return -1;
|
|
+ grub_error (GRUB_ERR_READ_ERROR, "jfs: block %" PRIuGRUB_UINT64_T " not found", blk);
|
|
+ return 0;
|
|
}
|
|
|
|
/* Get the block number for the block BLK in the node INODE in the
|
|
mounted filesystem DATA. */
|
|
-static grub_int64_t
|
|
+static grub_uint64_t
|
|
grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
|
|
grub_uint64_t blk)
|
|
{
|
|
--
|
|
2.50.1
|
|
|