From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: alexander.sverdlin@siemens.com
Cc: openembedded-core@lists.openembedded.org,
Bruce Ashfield <bruce.ashfield@gmail.com>
Subject: Re: [OE-core] [PATCH v3] kernel-fitimage: make signing failure fatal
Date: Tue, 3 Sep 2024 09:03:53 +0300 [thread overview]
Message-ID: <ZtamyY45LZ_6pYw1@nuoska> (raw)
In-Reply-To: <20240902161307.1222507-1-alexander.sverdlin@siemens.com>
Hi,
On Mon, Sep 02, 2024 at 06:13:06PM +0200, A. Sverdlin via lists.openembedded.org wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
>
> mkimage doesn't fail if it is not able to sign FIT nodes.
> This may lead to unbootable images in secure boot configurations.
> Make signing failures fatal by parsing the mkimage output.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> Changes in v3:
> - bbfatag_log -> bberror + bbfatal_log with relevant mkimage output snippets
> Changes in v2:
> - bbfatal -> bbfatal_log
>
> meta/classes-recipe/kernel-fitimage.bbclass | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
> index 67c98adb232..ccf848e643f 100644
> --- a/meta/classes-recipe/kernel-fitimage.bbclass
> +++ b/meta/classes-recipe/kernel-fitimage.bbclass
> @@ -753,11 +753,16 @@ fitimage_assemble() {
> # Step 8: Sign the image
> #
> if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
> - ${UBOOT_MKIMAGE_SIGN} \
> + output=$(${UBOOT_MKIMAGE_SIGN} \
Will this subshell return errors as before or is "set -e" propagated there?
> ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
> -F -k "${UBOOT_SIGN_KEYDIR}" \
> -r ${KERNEL_OUTPUT_DIR}/$2 \
> - ${UBOOT_MKIMAGE_SIGN_ARGS}
> + ${UBOOT_MKIMAGE_SIGN_ARGS})
> + echo "$output"
> + if err=$(echo "$output" | grep -C9 -E "Sign value:\s*unavailable"); then
> + bberror "${UBOOT_MKIMAGE_SIGN} failed to provide signatures for these images:"
> + bbfatal_log "\n$err"
Is the problem really in mkimage since it does not return errors when signing fails?
Cheers,
-Mikko
next prev parent reply other threads:[~2024-09-03 6:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 16:13 [PATCH v3] kernel-fitimage: make signing failure fatal A. Sverdlin
2024-09-03 6:03 ` Mikko Rapeli [this message]
2024-09-03 7:24 ` [OE-core] " Sverdlin, Alexander
2024-09-03 7:38 ` Mikko Rapeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZtamyY45LZ_6pYw1@nuoska \
--to=mikko.rapeli@linaro.org \
--cc=alexander.sverdlin@siemens.com \
--cc=bruce.ashfield@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox