u-boot: Fix CVE-2021-27097, CVE-2021-27138
PATCH 1/1 u-boot: Fix CVE-2021-27097, CVE-2021-27138
Backport fixes for CVE-2021-27097 and CVE-2021-27138 as well as a precursor fdt validation fix that allows using the upstream patches for the CVEs without significant rebasing. Note that the additional upstream changes to add new U-Boot fit image tests have been left out to keep the patch count down. Those tests are currently not used for ptest or oe-selftest, so it is believed their absence should not be problematic.
Signed-off-by Scott Murray <[email protected]>
--- .../files/0001-add-valid-fdt-check.patch | 36 ++ .../u-boot/files/CVE-2021-27097-1.patch | 71 +++ .../u-boot/files/CVE-2021-27097-2.patch | 419 ++++++++++++++++++ .../u-boot/files/CVE-2021-27097-3.patch | 105 +++++ .../u-boot/files/CVE-2021-27097-4.patch | 73 +++ .../u-boot/files/CVE-2021-27138-1.patch | 245 ++++++++++ .../u-boot/files/CVE-2021-27138-2.patch | 109 +++++ meta/recipes-bsp/u-boot/u-boot-common.inc | 7 + 8 files changed, 1065 insertions(+) create mode 100644 meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27097-1.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27097-2.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27097-3.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27097-4.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27138-1.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2021-27138-2.patch
meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch new file +36 -0
@@ -0,0 +1,36 @@ +From ea1a9ec5f430359720d9a0621ed1acfbba6a142a Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt <[email protected]> +Date: Wed, 13 Jan 2021 02:09:12 +0100 +Subject: [PATCH] image-fit: fit_check_format check for valid FDT + +fit_check_format() must check that the buffer contains a flattened device +tree before calling any device tree library functions. + +Failure to do may cause segmentation faults. + +Signed-off-by: Heinrich Schuchardt <[email protected]> + +Upstream-Status: Backport[https://github.com/u-boot/u-boot/commit/ea1a9ec5f430359720d9a0621ed1acfbba6a142a] +Signed-off-by: Scott Murray <[email protected]> + +--- + common/image-fit.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/common/image-fit.c b/common/image-fit.c +index 6a8787ca0a..21c44bdf69 100644 +--- a/common/image-fit.c ++++ b/common/image-fit.c +@@ -1553,6 +1553,12 @@ int fit_image_check_comp(const void *fit, int noffset, uint8_t comp) + */ + int fit_check_format(const void *fit) + { ++ /* A FIT image must be a valid FDT */ ++ if (fdt_check_header(fit)) { ++ debug("Wrong FIT format: not a flattened device tree\n"); ++ return 0; ++ } ++ + /* mandatory / node 'description' property */ + if (fdt_getprop(fit, 0, FIT_DESC_PROP, NULL) == NULL) { + debug("Wrong FIT format: no description\n");
meta/recipes-bsp/u-boot/files/CVE-2021-27097-1.patch new file +71 -0
71 lines not on this page · raw message
meta/recipes-bsp/u-boot/files/CVE-2021-27097-2.patch new file +419 -0
419 lines not on this page · raw message
meta/recipes-bsp/u-boot/files/CVE-2021-27097-3.patch new file +105 -0
105 lines not on this page · raw message
meta/recipes-bsp/u-boot/files/CVE-2021-27097-4.patch new file +73 -0
73 lines not on this page · raw message
meta/recipes-bsp/u-boot/files/CVE-2021-27138-1.patch new file +245 -0
245 lines not on this page · raw message
meta/recipes-bsp/u-boot/files/CVE-2021-27138-2.patch new file +109 -0
109 lines not on this page · raw message
meta/recipes-bsp/u-boot/u-boot-common.inc +7 -0
@@ -15,6 +15,13 @@ PE = "1" SRCREV = "c4fddedc48f336eabc4ce3f74940e6aa372de18c" SRC_URI = "git://git.denx.de/u-boot.git \ + file://0001-add-valid-fdt-check.patch \ + file://CVE-2021-27097-1.patch \ + file://CVE-2021-27097-2.patch \ + file://CVE-2021-27097-3.patch \ + file://CVE-2021-27097-4.patch \ + file://CVE-2021-27138-1.patch \ + file://CVE-2021-27138-2.patch \ " S = "${WORKDIR}/git"
Signature · 1 line
2.26.2