public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Michal Simek <michal.simek@amd.com>
Cc: xypron.glpk@gmx.de, ilias.apalodimas@linaro.org,
	sughosh.ganu@linaro.org, u-boot@lists.denx.de
Subject: Re: [PATCH] efi_loader: capsule: enforce guid check in api and capsule_on_disk
Date: Fri, 28 Jul 2023 10:55:05 +0900	[thread overview]
Message-ID: <ZMMf-fBgMawGZC5D@laputa> (raw)
In-Reply-To: <f99bde16-7a41-f492-e8bb-e66d33b4f7f4@amd.com>

Hi Michal,

On Thu, Jul 27, 2023 at 10:53:44AM +0200, Michal Simek wrote:
> 
> 
> On 7/27/23 02:38, AKASHI Takahiro wrote:
> > While UPDATE_CAPSULE api is not fully implemented, this interface and
> > capsule-on-disk feature should behave in the same way, especially in
> > handling an empty capsule for fwu multibank, for future enhancement.
> > 
> > So move the guid check into efi_capsule_update_firmware().
> > 
> > Fixed: commit a6aafce494ab ("efi_loader: use efi_update_capsule_firmware()
> > 	for capsule on disk")
> 
> just fyi: b4 mess this.
> You should likely put it on the same line and ignore line limit.
> 
> This is how this ends up.
> 
> handling an empty capsule for fwu multibank, for future enhancement.
> 
> So move the guid check into efi_capsule_update_firmware().
> 
>         for capsule on disk")
> 
> Fixed: commit a6aafce494ab ("efi_loader: use efi_update_capsule_firmware()
> Reported-by: Michal Simek <michal.simek@amd.com>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Link: https://lore.kernel.org/r/20230727003800.25105-1-takahiro.akashi@linaro.org
> 
> 
> 
> 
> > Reported-by: Michal Simek <michal.simek@amd.com>
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >   lib/efi_loader/efi_capsule.c | 17 ++++++++---------
> >   1 file changed, 8 insertions(+), 9 deletions(-)
> > 
> > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> > index 7a6f195cbc02..ddf8153e0982 100644
> > --- a/lib/efi_loader/efi_capsule.c
> > +++ b/lib/efi_loader/efi_capsule.c
> > @@ -581,6 +581,13 @@ static efi_status_t efi_capsule_update_firmware(
> >   		fw_accept_os = capsule_data->flags & FW_ACCEPT_OS ? 0x1 : 0x0;
> >   	}
> > +	if (guidcmp(&capsule_data->capsule_guid,
> > +		    &efi_guid_firmware_management_capsule_id)) {
> > +		log_err("Unsupported capsule type: %pUs\n",
> > +			&capsule_data->capsule_guid);
> > +		return EFI_UNSUPPORTED;
> > +	}
> > +
> >   	/* sanity check */
> >   	if (capsule_data->header_size < sizeof(*capsule) ||
> >   	    capsule_data->header_size >= capsule_data->capsule_image_size)
> > @@ -751,15 +758,7 @@ efi_status_t EFIAPI efi_update_capsule(
> >   		log_debug("Capsule[%d] (guid:%pUs)\n",
> >   			  i, &capsule->capsule_guid);
> > -		if (!guidcmp(&capsule->capsule_guid,
> > -			     &efi_guid_firmware_management_capsule_id)) {
> > -			ret  = efi_capsule_update_firmware(capsule);
> > -		} else {
> > -			log_err("Unsupported capsule type: %pUs\n",
> > -				&capsule->capsule_guid);
> > -			ret = EFI_UNSUPPORTED;
> > -		}
> > -
> > +		ret  = efi_capsule_update_firmware(capsule);
> >   		if (ret != EFI_SUCCESS)
> >   			goto out;
> >   	}
> 
> I have no problem with this patch because it works as the previous one. When
> commit message is fixed feel free to add
> Tested-by: Michal Simek <michal.simek@amd.com>

I hope that the maintainer would take care of it when he tries to merge
the patch.

> And regarding empty capsule functionality with A/B.
> I boot from A. Download capsules and run disk-update to get to Image B and
> trial state and I can download and apply acceptance capsule by hand via
> efidebug capsule update <addr>. That works fine for acceptance capsule is
> reflected via fwu in mdata.
> When I apply revert capsule there is nothing visible in mdata and I think it
> should. The only visibility is that it resets to A system. Is this the only
> intention of revert capsules?
> (keep in mind that I use two images per bank).
> 
> Empty capsules are just accepted only in trial state which is understandable.
> 
> And I also see that with latest master branch capsule on disk feature is not
> working properly. Capsule are not processed at all. Can you please double
> check it?

I locally ran the pytest with v2023.10-rc1, and
- test_capsule_firmware_raw passed
- test_capsule_firmware_signed_raw failed

but it seems to me that 'signed_raw' failure is not directly
related to efi implementation (I didn't dig into details, though).

Can you describe more about your environment?

-Takahiro Akashi

> Thanks,
> Michal
> 
> 

  reply	other threads:[~2023-07-28  1:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  0:38 [PATCH] efi_loader: capsule: enforce guid check in api and capsule_on_disk AKASHI Takahiro
2023-07-27  8:53 ` Michal Simek
2023-07-28  1:55   ` AKASHI Takahiro [this message]
2023-07-31 12:10     ` Michal Simek
2023-07-31 12:12       ` Michal Simek
2023-07-31 13:01 ` Ilias Apalodimas

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=ZMMf-fBgMawGZC5D@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox