From 7a5f4e4c2f8956b3e4d5b0957990b9ea1818bedb Mon Sep 17 00:00:00 2001 From: Mayuresh Chitale Date: Tue, 2 May 2023 21:40:20 +0530 Subject: spl: ext: Use partition size for mount Since commit 9905cae65e03 ("fs: ext4: check the minimal partition size to mount"), a valid size needs to be provided when mounting an ext filesystem. Fix the spl ext driver to use the parition size instead of 0 when mounting the filesystem. Signed-off-by: Mayuresh Chitale --- common/spl/spl_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index f117c63..2bf3434 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -28,7 +28,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, ext4fs_set_blk_dev(block_dev, &part_info); - err = ext4fs_mount(0); + err = ext4fs_mount(part_info.size); if (!err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: ext4fs mount err - %d\n", __func__, err); @@ -82,7 +82,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image, ext4fs_set_blk_dev(block_dev, &part_info); - err = ext4fs_mount(0); + err = ext4fs_mount(part_info.size); if (!err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: ext4fs mount err - %d\n", __func__, err); -- cgit v1.1 From a7536e95e2f2a07be369628f7e9b517b20210e4b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 17 Jun 2023 11:49:48 +0100 Subject: menu: Re-enable the ANSI codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The intent here was to allow ANSI codes to be disabled, since it was proving impoosible to test operation of the menu code when it kept moving the cursor. Unfortunately this ended up in the patch. Correct this by enabling ANSI again. Signed-off-by: Simon Glass Reported-by: Pali Rohár Reported-by: Mark Kettenis Reported-by: Frank Wunderlich Fixes: 32bab0eae51b ("menu: Make use of CLI character processing") Tested-by: Mark Kettenis Reviewed-by: Mark Kettenis --- common/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/menu.c b/common/menu.c index 9451417..b55cf7b 100644 --- a/common/menu.c +++ b/common/menu.c @@ -15,7 +15,7 @@ #include "menu.h" -#define ansi 0 +#define ansi 1 /* * Internally, each item in a menu is represented by a struct menu_item. -- cgit v1.1 From 77aed22b48ab789491cf96cd2ba3128124e51eee Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 29 May 2023 14:04:06 +0200 Subject: spl: spl_legacy: Add extra address checks Check whether the loaded image or entry point does not overlap SPL. Signed-off-by: Marek Vasut --- common/spl/spl_legacy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'common') diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index 16851c5..d34bc54 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -15,6 +16,22 @@ #define LZMA_LEN (1 << 20) +static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size) +{ + uintptr_t spl_start = (uintptr_t)_start; + uintptr_t spl_end = (uintptr_t)__bss_end; + uintptr_t end = start + size; + + if ((start >= spl_start && start < spl_end) || + (end > spl_start && end <= spl_end) || + (start < spl_start && end >= spl_end) || + (start > end && end > spl_start)) + panic("SPL: Image overlaps SPL\n"); + + if (size > CONFIG_SYS_BOOTM_LEN) + panic("SPL: Image too large\n"); +} + int spl_parse_legacy_header(struct spl_image_info *spl_image, const struct legacy_img_hdr *header) { @@ -58,6 +75,9 @@ int spl_parse_legacy_header(struct spl_image_info *spl_image, "payload image: %32s load addr: 0x%lx size: %d\n", spl_image->name, spl_image->load_addr, spl_image->size); + spl_parse_legacy_validate(spl_image->load_addr, spl_image->size); + spl_parse_legacy_validate(spl_image->entry_point, 0); + return 0; } -- cgit v1.1 From 6039e0edc8540bd2abee780549b260bdaf089168 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 28 May 2023 23:00:30 +0200 Subject: imx: hab: Simplify the mechanism The current mechanism is unnecessarily complex. Simplify the whole mechanism such that the entire fitImage is signed, IVT is placed at the end, followed by CSF, and this entire bundle is also authenticated. This makes the signing scripting far simpler. Signed-off-by: Marek Vasut --- common/spl/spl_fit.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'common') diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index c51482b..730639f 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -27,10 +27,6 @@ struct spl_fit_info { int conf_node; /* FDT offset to selected configuration node */ }; -__weak void board_spl_fit_post_load(const void *fit) -{ -} - __weak ulong board_spl_fit_size_align(ulong size) { return size; @@ -829,8 +825,5 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, spl_image->flags |= SPL_FIT_FOUND; - if (IS_ENABLED(CONFIG_IMX_HAB)) - board_spl_fit_post_load(ctx.fit); - return 0; } -- cgit v1.1 From 1b8a1be1a1f143ce6294e2dcd5244d995cdba8cf Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 30 Jun 2023 23:30:53 -0300 Subject: spl: spl_legacy: Fix spl_end address Currently, spl_end points to the __bss_end address, which is an external RAM address instead of the end of the SPL text section in the internal RAM. This causes boot failures on imx6-colibri, for example: ``` Trying to boot from MMC1 SPL: Image overlaps SPL resetting ... ``` Fix this problem by assigning spl_end to _image_binary_end, as this symbol properly represents the end of the SPL text section. From u-boot-spl.map: .end *(.__end) 0x00000000009121a4 _image_binary_end = . Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks") Reported-by: Francesco Dolcini Signed-off-by: Fabio Estevam Tested-by: Tom Rini Reviewed-by: Marek Vasut Tested-by: Marek Vasut # DH i.MX6Q DHCOM PDK2 --- common/spl/spl_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index d34bc54..095443c 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -19,7 +19,7 @@ static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size) { uintptr_t spl_start = (uintptr_t)_start; - uintptr_t spl_end = (uintptr_t)__bss_end; + uintptr_t spl_end = (uintptr_t)_image_binary_end; uintptr_t end = start + size; if ((start >= spl_start && start < spl_end) || -- cgit v1.1