All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vincent Stehlé" <vincent.stehle@arm.com>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.u-boot-project.org,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Tom Rini <trini@konsulko.com>,
	Sughosh Ganu <sughosh.ganu@arm.com>, Udit Kumar <u-kumar1@ti.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: Re: [PATCH 2/2] efi_selftest: add minimal fmp test
Date: Thu, 1 Oct 2026 17:46:42 +0200	[thread overview]
Message-ID: <ar6AYk2f_na162Ed@debian> (raw)
In-Reply-To: <CAFLszThhM2msTbVUmtAvaZzepE6qmb1w-GMb9SV5xYZY862BXQ@mail.gmail.com>

On Thu, Oct 01, 2026 at 02:31:48AM +0100, Simon Glass wrote:
> Hi Vincent,

Hi Simon,

Thank you very much for your review.
I will send a v2 addressing all your remarks.

Best regards,
Vincent.

> 
> On 2026-09-22T14:58:39, Vincent Stehlé <vincent.stehle@arm.com> wrote:
> > efi_selftest: add minimal fmp test
> >
> > Add a minimal test for the UEFI Firmware Management Protocol.
> > At this point the test only does the following:
> >
> > - Get current firmware images info.
> > - For each image, verify consistency of the authentication flags.
> >
> > This can be tested on the sandbox with the following command:
> >
> >   ./u-boot -T -c "setenv efi_selftest firmware management protocol; \
> >                   bootefi selftest"
> >
> > Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> > Cc: Tom Rini <trini@konsulko.com>
> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> >
> > lib/efi_selftest/Makefile           |   2 +
> >  lib/efi_selftest/efi_selftest_fmp.c | 135 ++++++++++++++++++++++++++++++++++++
> >  2 files changed, 137 insertions(+)
> 
> > diff --git a/lib/efi_selftest/efi_selftest_fmp.c b/lib/efi_selftest/efi_selftest_fmp.c
> > @@ -0,0 +1,135 @@
> > +     /* Verify each image info */
> > +     for (i = 0; i < desc_cnt; i++) {
> > +             const struct efi_firmware_image_descriptor *inf = &img_info[i];
> 
> The spec says callers must step through the array using
> DescriptorSize, since firmware may return a larger (newer) descriptor
> than the one we know about. U-Boot happens to use sizeof(), but since
> this is a protocol test, please can you use desc_size as the stride,
> e.g. (void *)img_info + i * desc_size, and perhaps check that
> desc_size >= sizeof(*inf)?
> 
> > diff --git a/lib/efi_selftest/efi_selftest_fmp.c b/lib/efi_selftest/efi_selftest_fmp.c
> > @@ -0,0 +1,135 @@
> > +             /* Verify authentication */
> > +             if (CONFIG_IS_ENABLED(EFI_CAPSULE_AUTHENTICATE) &&
> > +                 (attr_supp & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) &&
> > +                 !(attr_supp & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
> > +                     efi_st_error("Bad AttributesSupported %u\n",
> > +                                  (unsigned int)attr_supp);
> > +                     goto out;
> > +             }
> 
> efi_firmware.c uses IS_ENABLED(CONFIG_EFI_CAPSULE_AUTHENTICATE), so
> please match that. There is no SPL variant of this option, so
> CONFIG_IS_ENABLED() just adds confusion.
> 
> This only checks one direction. You could also check that any bit set
> in AttributesSetting is also set in AttributesSupported, and that
> AUTHENTICATION_REQUIRED is not set in AttributesSetting when
> authentication is disabled. That would also catch regressions on
> boards without CONFIG_EFI_CAPSULE_AUTHENTICATE. What do you think?
> 
> > diff --git a/lib/efi_selftest/efi_selftest_fmp.c b/lib/efi_selftest/efi_selftest_fmp.c
> > @@ -0,0 +1,135 @@
> > +     ret = boottime->locate_protocol(&firmware_management_protocol_guid,
> > +                                     NULL, (void **)&fmp);
> 
> This only tests the first FMP instance. With
> CONFIG_EFI_CAPSULE_FIRMWARE_FIT and _RAW both enabled on sandbox there
> can be two, so using locate_handle_buffer() and checking each one
> would make the test more useful as it grows. I'm fine with leaving
> that for later though, since the patch says 'minimal'.
> 
> Regards,
> Simon

  reply	other threads:[~2026-10-01 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 14:58 [PATCH 0/2] efi: fix and test FMP image info authentication attribute Vincent Stehlé
2026-09-22 14:58 ` [PATCH 1/2] efi_loader: fix " Vincent Stehlé
2026-10-01  1:31   ` Simon Glass
2026-10-01 12:37   ` Ilias Apalodimas
2026-09-22 14:58 ` [PATCH 2/2] efi_selftest: add minimal fmp test Vincent Stehlé
2026-10-01  1:31   ` Simon Glass
2026-10-01 15:46     ` Vincent Stehlé [this message]
2026-10-01 13:55   ` Heinrich Schuchardt
2026-10-02  9:26     ` Vincent Stehlé
2026-10-02 14:39       ` Heinrich Schuchardt
2026-10-02  8:37 ` [PATCH v2 0/2] efi: fix and test FMP image info authentication attribute Vincent Stehlé
2026-10-02  8:37   ` [PATCH v2 1/2] efi_loader: fix " Vincent Stehlé
2026-10-03  5:39     ` Simon Glass
2026-10-08 10:33     ` Ilias Apalodimas
2026-10-02  8:37   ` [PATCH v2 2/2] efi_selftest: add minimal fmp test Vincent Stehlé
2026-10-03  5:40     ` Simon Glass
2026-10-03 15:23       ` Tom Rini

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=ar6AYk2f_na162Ed@debian \
    --to=vincent.stehle@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@arm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=u-kumar1@ti.com \
    --cc=xypron.glpk@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.