public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] efi_loader: workaround for EDK2's shell.efi
Date: Thu, 9 Aug 2018 17:30:49 +0900	[thread overview]
Message-ID: <20180809083048.GR11258@linaro.org> (raw)
In-Reply-To: <e46e2061-11e9-dcd2-31e0-0d2c22688787@suse.de>

On Thu, Aug 09, 2018 at 07:55:06AM +0100, Alexander Graf wrote:
> 
> 
> On 09.08.18 07:15, AKASHI Takahiro wrote:
> > The commit 21b3edfc964 ("efi_loader: check parameters of CreateEvent")
> > enforces a strict parameter check at CreateEvent().  Unfortunately,
> > however, EDK2's Shell.efi calls this function with notify_tpl == 0.
> > 
> > The patch above does right thing and we'd better fix the issue on EDK2
> > side, and yet we might want a workaround allowing for running un-modified
> > version of EDK2 in short-term solution.
> 
> ... of the EDK2 shell ...
> 
> and it's not just about short term - we always want to be compatible :).

Okay.

> So what's the reason this does not trigger in edk2? Are they considering
> TPL 0 a valid TPL always or did they just forget the check in create
> event? If they always consider TPL 0 valid, we better change
> is_valid_tpl to ensure compatibility with edk2's behavior.

I'm not confident about what Shell's intent is.
Created here is an event to be used to raise a signal for "notification
of Ctrl-C keystrokes," and hence Shell expects such key data to always
be sent to a task whatever its TPL is?

> > The patch provides a minimum mitigation of parameter check.
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  lib/efi_loader/efi_boottime.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> > index 2281703f261..e7a19c35415 100644
> > --- a/lib/efi_loader/efi_boottime.c
> > +++ b/lib/efi_loader/efi_boottime.c
> > @@ -627,7 +627,8 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
> >  		return EFI_INVALID_PARAMETER;
> >  	}
> >  
> > -	if (is_valid_tpl(notify_tpl) != EFI_SUCCESS)
> > +	/* notify_tpl == 0: workaround for EDK2's Shell.efi */
> 
> That comment is too undescriptive. Better write something like "EDK2
> accepts TPL 0 in CreateEvent, so to ensure compatibility we should do
> the same. EDK2 Shell.efi depends on this."

Nice!

Thanks,
-Takahiro AKASHI

> 
> Alex
> 
> > +	if (notify_tpl && (is_valid_tpl(notify_tpl) != EFI_SUCCESS))
> >  		return EFI_INVALID_PARAMETER;
> >  
> >  	evt = calloc(1, sizeof(struct efi_event));
> > 

  reply	other threads:[~2018-08-09  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  6:15 [U-Boot] [RFC] efi_loader: workaround for EDK2's shell.efi AKASHI Takahiro
2018-08-09  6:55 ` Alexander Graf
2018-08-09  8:30   ` AKASHI Takahiro [this message]
2018-08-09 10:38     ` Alexander Graf
2018-08-09 12:21 ` Heinrich Schuchardt
2018-08-09 13:08 ` Leif Lindholm
2018-08-10  0:15   ` AKASHI Takahiro

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=20180809083048.GR11258@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.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