summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2022-02-18 11:05:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 00:21:37 +0000
commite2f193d252179af65ea68fcebf04c913039f014c (patch)
tree7ccdfb033e2c8df77ae11320750f46a3da89a913 /meta/recipes-bsp
parent10d619c8bb87493a4a502188571be33935c80f1b (diff)
downloadpoky-e2f193d252179af65ea68fcebf04c913039f014c.tar.gz
grub: add a fix for a possible unintended sign extension
This patch fixes a possible unintended sign extension in grub's libgcrypt/mpi. It is a part of a security series [1]. [1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html (From OE-Core rev: 69f6ae604b857eea93022d73fad668df07a7a056) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp')
-rw-r--r--meta/recipes-bsp/grub/files/0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch36
-rw-r--r--meta/recipes-bsp/grub/grub2.inc1
2 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch b/meta/recipes-bsp/grub/files/0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch
new file mode 100644
index 0000000000..f500f1a296
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch
@@ -0,0 +1,36 @@
1From 9b16d7bcad1c7fea7f26eb2fb3af1a5ca70ba34e Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Tue, 3 Nov 2020 16:43:37 +0000
4Subject: [PATCH] libgcrypt/mpi: Fix possible unintended sign extension
5
6The array of unsigned char gets promoted to a signed 32-bit int before
7it is finally promoted to a size_t. There is the possibility that this
8may result in the signed-bit being set for the intermediate signed
932-bit int. We should ensure that the promotion is to the correct type
10before we bitwise-OR the values.
11
12Fixes: CID 96697
13
14Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
15Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
16
17Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=e8814c811132a70f9b55418f7567378a34ad3883]
18Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
19
20---
21 grub-core/lib/libgcrypt/mpi/mpicoder.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24diff --git a/grub-core/lib/libgcrypt/mpi/mpicoder.c b/grub-core/lib/libgcrypt/mpi/mpicoder.c
25index a3435ed..7ecad27 100644
26--- a/grub-core/lib/libgcrypt/mpi/mpicoder.c
27+++ b/grub-core/lib/libgcrypt/mpi/mpicoder.c
28@@ -458,7 +458,7 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
29 if (len && len < 4)
30 return gcry_error (GPG_ERR_TOO_SHORT);
31
32- n = (s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
33+ n = ((size_t)s[0] << 24 | (size_t)s[1] << 16 | (size_t)s[2] << 8 | (size_t)s[3]);
34 s += 4;
35 if (len)
36 len -= 4;
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index 13e2b1600d..be35ac04ef 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -72,6 +72,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
72 file://0023-zfs-Fix-possible-integer-overflows.patch \ 72 file://0023-zfs-Fix-possible-integer-overflows.patch \
73 file://0024-zfsinfo-Correct-a-check-for-error-allocating-memory.patch \ 73 file://0024-zfsinfo-Correct-a-check-for-error-allocating-memory.patch \
74 file://0025-affs-Fix-memory-leaks.patch \ 74 file://0025-affs-Fix-memory-leaks.patch \
75 file://0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch \
75 " 76 "
76SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" 77SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
77SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" 78SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"