From ae5f231d0106f4dde811c2bc15e479dc7ea463e7 Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Tue, 25 Aug 2026 09:29:54 +0200 Subject: [PATCH 1/3] rimage: reject unsupported MEU signing modes Leave unsupported SUE and ACE MEU callbacks unset and report a runtime error before writer dispatch. Signed-off-by: Adrian Bonislawski --- tools/rimage/src/adsp_config.c | 4 ++-- tools/rimage/src/rimage.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/rimage/src/adsp_config.c b/tools/rimage/src/adsp_config.c index 6cc7434e74bc..931c77e10403 100644 --- a/tools/rimage/src/adsp_config.c +++ b/tools/rimage/src/adsp_config.c @@ -2052,7 +2052,7 @@ static int parse_adsp_config_v1_5(const toml_table_t *toml, struct image *image) /* assign correct write functions */ out->write_firmware = man_write_fw_v1_5_sue; - out->write_firmware_meu = man_write_fw_meu_v1_5; + out->write_firmware_meu = NULL; out->verify_firmware = ri_manifest_verify_v1_5; /* parse others sibtables */ @@ -2235,7 +2235,7 @@ static int parse_adsp_config_ace_v1_5(const toml_table_t *toml, struct image *im /* assign correct write functions */ out->write_firmware = man_write_fw_ace_v1_5; - out->write_firmware_meu = man_write_fw_meu_v2_5; + out->write_firmware_meu = NULL; out->verify_firmware = ri_manifest_verify_v2_5; /* version array has already been parsed, so increment ctx.array_cnt */ diff --git a/tools/rimage/src/rimage.c b/tools/rimage/src/rimage.c index 2245288dfece..0b41905944c2 100644 --- a/tools/rimage/src/rimage.c +++ b/tools/rimage/src/rimage.c @@ -202,6 +202,12 @@ int main(int argc, char *argv[]) goto out; } + if (image.meu_offset && !image.adsp->write_firmware_meu) { + fprintf(stderr, "error: MEU signing is not supported for this target\n"); + ret = -EINVAL; + goto out; + } + /* set IMR Type and the PV bit in found machine definition */ if (image.adsp->man_v1_8) { if (imr_type_override) @@ -274,7 +280,6 @@ int main(int argc, char *argv[]) /* process and write output */ if (image.meu_offset) { - assert(image.adsp->write_firmware_meu); ret = image.adsp->write_firmware_meu(&image); } else { assert(image.adsp->write_firmware); From dd49c892f2d5e8d06c865775a64656b36bed6622 Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Tue, 25 Aug 2026 09:36:15 +0200 Subject: [PATCH 2/3] rimage: require module configuration for relocatable images Reject relocatable manifest creation when the TOML configuration does not provide module metadata. Signed-off-by: Adrian Bonislawski --- tools/rimage/src/manifest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/rimage/src/manifest.c b/tools/rimage/src/manifest.c index 22eddfa00c74..92e7cc11842c 100644 --- a/tools/rimage/src/manifest.c +++ b/tools/rimage/src/manifest.c @@ -542,6 +542,11 @@ static int man_module_create_reloc(struct image *image, struct manifest_module * struct elf_section section; int err; + if (!modules) { + fprintf(stderr, "error: relocatable image requires module configuration\n"); + return -EINVAL; + } + /* load in module manifest data */ err = elf_section_read_by_name(&module->file.elf, ".module", §ion); if (err) { From 2a68c4fcb722f890a94502b253ee22db7297a86c Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Tue, 25 Aug 2026 10:34:43 +0200 Subject: [PATCH 3/3] rimage: fix CSE header detection check when re-signing Test the outcome of the scan instead of the loop index, so the check no longer depends on the loop bound, and align the message with the one used by verify_image(). Signed-off-by: Adrian Bonislawski --- tools/rimage/src/manifest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/rimage/src/manifest.c b/tools/rimage/src/manifest.c index 92e7cc11842c..db89d5f699b0 100644 --- a/tools/rimage/src/manifest.c +++ b/tools/rimage/src/manifest.c @@ -1791,8 +1791,12 @@ int resign_image(struct image *image) } } - if (i >= size) { - fprintf(stderr, "error: didn't found header marker %d\n", i); + /* the scan stops a full marker before the end, so a trailing partial word + * leaves the loop index below the size; test the result of the scan itself + */ + if (!image->fw_image) { + fprintf(stderr, "error: could not find valid CSE header $CPD in %s\n", + image->in_file); ret = -EINVAL; goto out; }