Skip to contentSkip to conversation

: u-boot: add CVE patches for u-boot

yocto New [email protected] 1 participant 2 messages Sep 26, 2019

lore
Share & tools
lore
#0 lore raw

From: Limeng <[email protected]>

Add 9 patches to fix below CVE issues.
CVE-2019-13103
CVE-2019-13104
CVE-2019-13105
CVE-2019-13106
CVE-2019-14192
CVE-2019-14193
CVE-2019-14194
CVE-2019-14195
CVE-2019-14196
CVE-2019-14197
CVE-2019-14198
CVE-2019-14199
CVE-2019-14200
CVE-2019-14201
CVE-2019-14202
CVE-2019-14203
CVE-2019-14204

Detail patches as below:

0001-u-boot-add-CVE-patches-for-u-boot.patch

 files/0001-CVE-2019-13103.patch                               |   69 ++++++++++
 files/0002-CVE-2019-13104.patch                               |   49 +++++++
 files/0003-CVE-2019-13105.patch                               |   37 +++++
 files/0004-CVE-2019-13106.patch                               |   56 ++++++++
 files/0005-CVE-2019-14192-14193-14199.patch                   |   43 ++++++
 files/0006-CVE-2019-14197-14200-14201-14202-14203-14204.patch |   44 ++++++
 files/0007-CVE-2019-14194-14198.patch                         |   42 ++++++
 files/0008-CVE-2019-14195.patch                               |   42 ++++++
 files/0009-CVE-2019-14196.patch                               |   48 ++++++
 u-boot-common.inc                                             |   12 +
 10 files changed, 441 insertions(+), 1 deletion(-)

thanks,
Limeng

#1 lore raw

PATCH 1/1 u-boot: add CVE patches for u-boot

From: Limeng <[email protected]>

Add 9 patches to fix below CVE issues.
CVE-2019-13103
CVE-2019-13104
CVE-2019-13105
CVE-2019-13106
CVE-2019-14192
CVE-2019-14193
CVE-2019-14194
CVE-2019-14195
CVE-2019-14196
CVE-2019-14197
CVE-2019-14198
CVE-2019-14199
CVE-2019-14200
CVE-2019-14201
CVE-2019-14202
CVE-2019-14203
CVE-2019-14204

---
 .../u-boot/files/0001-CVE-2019-13103.patch    | 69 +++++++++++++++++++
 .../u-boot/files/0002-CVE-2019-13104.patch    | 49 +++++++++++++
 .../u-boot/files/0003-CVE-2019-13105.patch    | 37 ++++++++++
 .../u-boot/files/0004-CVE-2019-13106.patch    | 56 +++++++++++++++
 .../0005-CVE-2019-14192-14193-14199.patch     | 43 ++++++++++++
 ...-14197-14200-14201-14202-14203-14204.patch | 44 ++++++++++++
 .../files/0007-CVE-2019-14194-14198.patch     | 42 +++++++++++
 .../u-boot/files/0008-CVE-2019-14195.patch    | 42 +++++++++++
 .../u-boot/files/0009-CVE-2019-14196.patch    | 48 +++++++++++++
 meta/recipes-bsp/u-boot/u-boot-common.inc     | 12 +++-
 10 files changed, 441 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-bsp/u-boot/files/0001-CVE-2019-13103.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0002-CVE-2019-13104.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0003-CVE-2019-13105.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0004-CVE-2019-13106.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0005-CVE-2019-14192-14193-14199.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0006-CVE-2019-14197-14200-14201-14202-14203-14204.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0007-CVE-2019-14194-14198.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0008-CVE-2019-14195.patch
 create mode 100644 meta/recipes-bsp/u-boot/files/0009-CVE-2019-14196.patch
meta/recipes-bsp/u-boot/files/0001-CVE-2019-13103.patch new file +69 -0
new file mode 100644
index 0000000000..1a5d1eb996
@@ -0,0 +1,69 @@
+From 39a759494f734c4cdc3e2b919671bfb3134b41ae Mon Sep 17 00:00:00 2001
+From: Paul Emge <[email protected]>
+Date: Mon, 8 Jul 2019 16:37:03 -0700
+Subject: [PATCH 1/9] CVE-2019-13103: disk: stop infinite recursion in DOS
+ Partitions
+
+part_get_info_extended and print_partition_extended can recurse infinitely
+while parsing a self-referential filesystem or one with a silly number of
+extended partitions. This patch adds a limit to the number of recursive
+partitions.
+
+Signed-off-by: Paul Emge <[email protected]>
+
+Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
+                 h=232e2f4fd9a24bf08215ddc8c53ccadffc841fb5]
+
+CVE: CVE-2019-13103
+
+Signed-off-by: Meng Li <[email protected]>
+---
+ disk/part_dos.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/disk/part_dos.c b/disk/part_dos.c
+index 936cee0d36..aae9d95906 100644
+--- a/disk/part_dos.c
++++ b/disk/part_dos.c
+@@ -23,6 +23,10 @@
+ 
+ #define DOS_PART_DEFAULT_SECTOR 512
+ 
++/* should this be configurable? It looks like it's not very common at all
++ * to use large numbers of partitions */
++#define MAX_EXT_PARTS 256
++
+ /* Convert char[4] in little endian format to the host format integer
+  */
+ static inline unsigned int le32_to_int(unsigned char *le32)
+@@ -126,6 +130,13 @@ static void print_partition_extended(struct blk_desc *dev_desc,
+ 	dos_partition_t *pt;
+ 	int i;
+ 
++	/* set a maximum recursion level */
++	if (part_num > MAX_EXT_PARTS)
++	{
++		printf("** Nested DOS partitions detected, stopping **\n");
++		return;
++    }
++
+ 	if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
+ 		printf ("** Can't read partition table on %d:" LBAFU " **\n",
+ 			dev_desc->devnum, ext_part_sector);
+@@ -191,6 +202,13 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
+ 	int i;
+ 	int dos_type;
+ 
++	/* set a maximum recursion level */
++	if (part_num > MAX_EXT_PARTS)
++	{
++		printf("** Nested DOS partitions detected, stopping **\n");
++		return -1;
++    }
++
+ 	if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
+ 		printf ("** Can't read partition table on %d:" LBAFU " **\n",
+ 			dev_desc->devnum, ext_part_sector);
+-- 
+2.17.1
+
meta/recipes-bsp/u-boot/files/0002-CVE-2019-13104.patch new file +49 -0

49 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0003-CVE-2019-13105.patch new file +37 -0
new file mode 100644
index 0000000000..f525147e57
@@ -0,0 +1,37 @@
+From 4e937d0de669ee69cf41c20494cbf66c339c3174 Mon Sep 17 00:00:00 2001
+From: Paul Emge <[email protected]>
+Date: Mon, 8 Jul 2019 16:37:04 -0700
+Subject: [PATCH 3/9] CVE-2019-13105: ext4: fix double-free in ext4_cache_read
+
+ext_cache_read doesn't null cache->buf, after freeing, which results
+in a later function double-freeing it. This patch fixes
+ext_cache_read to call ext_cache_fini instead of free.
+
+Signed-off-by: Paul Emge <[email protected]>
+
+Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
+                 h=6e5a79de658cb1c8012c86e0837379aa6eabd024]
+
+CVE: CVE-2019-13105
+
+Signed-off-by: Meng Li <[email protected]>
+---
+ fs/ext4/ext4fs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
+index c8c8655ed8..e2b740cac4 100644
+--- a/fs/ext4/ext4fs.c
++++ b/fs/ext4/ext4fs.c
+@@ -288,7 +288,7 @@ int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size)
+ 	if (!cache->buf)
+ 		return 0;
+ 	if (!ext4fs_devread(block, 0, size, cache->buf)) {
+-		free(cache->buf);
++		ext_cache_fini(cache);
+ 		return 0;
+ 	}
+ 	cache->block = block;
+-- 
+2.17.1
+
meta/recipes-bsp/u-boot/files/0004-CVE-2019-13106.patch new file +56 -0

56 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0005-CVE-2019-14192-14193-14199.patch new file +43 -0

43 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0006-CVE-2019-14197-14200-14201-14202-14203-14204.patch new file +44 -0

44 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0007-CVE-2019-14194-14198.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0008-CVE-2019-14195.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-bsp/u-boot/files/0009-CVE-2019-14196.patch new file +48 -0

48 lines not on this page · raw message

meta/recipes-bsp/u-boot/u-boot-common.inc +11 -1
index ad043dbcde..b4525181eb 100644
@@ -10,6 +10,16 @@ PE = "1"
 # repo during parse
 SRCREV = "e5aee22e4be75e75a854ab64503fc80598bc2004"
 
-SRC_URI = "git://git.denx.de/u-boot.git"
+SRC_URI = "git://git.denx.de/u-boot.git \
+           file://0001-CVE-2019-13103.patch \
+           file://0002-CVE-2019-13104.patch \
+           file://0003-CVE-2019-13105.patch \
+           file://0004-CVE-2019-13106.patch \
+           file://0005-CVE-2019-14192-14193-14199.patch \
+           file://0006-CVE-2019-14197-14200-14201-14202-14203-14204.patch \
+           file://0007-CVE-2019-14194-14198.patch \
+           file://0008-CVE-2019-14195.patch \
+           file://0009-CVE-2019-14196.patch \
+"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.17.1