diff options
author | Scott Murray <scott.murray@konsulko.com> | 2021-03-21 22:53:55 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-23 22:51:25 +0000 |
commit | 33132ec14676c62167d86cb1efff7c1f5ded107f (patch) | |
tree | 69cd029244b918f9195b804f7c5187ecc9461806 /meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch | |
parent | f0d268181e2a67ad2c50b5e77f921b34c1f32ba4 (diff) | |
download | poky-33132ec14676c62167d86cb1efff7c1f5ded107f.tar.gz |
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.
(From OE-Core rev: b6c2df341d7e6da5defca9a5567fdb7212489efa)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch')
-rw-r--r-- | meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch b/meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch new file mode 100644 index 0000000000..d4ac9e2ed9 --- /dev/null +++ b/meta/recipes-bsp/u-boot/files/0001-add-valid-fdt-check.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From ea1a9ec5f430359720d9a0621ed1acfbba6a142a Mon Sep 17 00:00:00 2001 | ||
2 | From: Heinrich Schuchardt <xypron.glpk@gmx.de> | ||
3 | Date: Wed, 13 Jan 2021 02:09:12 +0100 | ||
4 | Subject: [PATCH] image-fit: fit_check_format check for valid FDT | ||
5 | |||
6 | fit_check_format() must check that the buffer contains a flattened device | ||
7 | tree before calling any device tree library functions. | ||
8 | |||
9 | Failure to do may cause segmentation faults. | ||
10 | |||
11 | Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> | ||
12 | |||
13 | Upstream-Status: Backport[https://github.com/u-boot/u-boot/commit/ea1a9ec5f430359720d9a0621ed1acfbba6a142a] | ||
14 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
15 | |||
16 | --- | ||
17 | common/image-fit.c | 6 ++++++ | ||
18 | 1 file changed, 6 insertions(+) | ||
19 | |||
20 | diff --git a/common/image-fit.c b/common/image-fit.c | ||
21 | index 6a8787ca0a..21c44bdf69 100644 | ||
22 | --- a/common/image-fit.c | ||
23 | +++ b/common/image-fit.c | ||
24 | @@ -1553,6 +1553,12 @@ int fit_image_check_comp(const void *fit, int noffset, uint8_t comp) | ||
25 | */ | ||
26 | int fit_check_format(const void *fit) | ||
27 | { | ||
28 | + /* A FIT image must be a valid FDT */ | ||
29 | + if (fdt_check_header(fit)) { | ||
30 | + debug("Wrong FIT format: not a flattened device tree\n"); | ||
31 | + return 0; | ||
32 | + } | ||
33 | + | ||
34 | /* mandatory / node 'description' property */ | ||
35 | if (fdt_getprop(fit, 0, FIT_DESC_PROP, NULL) == NULL) { | ||
36 | debug("Wrong FIT format: no description\n"); | ||