All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] efi_loader: workaround for EDK2's shell.efi
Date: Thu, 9 Aug 2018 14:21:11 +0200	[thread overview]
Message-ID: <d942b81b-eec7-8662-31fe-d43fcf2248b8@gmx.de> (raw)
In-Reply-To: <20180809061538.6624-1-takahiro.akashi@linaro.org>

On 08/09/2018 08:15 AM, AKASHI Takahiro wrote:
> The commit 21b3edfc964 ("efi_loader: check parameters of CreateEvent")

scripts/checkpatch.pl wants 12 digits for the commit reference.

ERROR: Please use git commit description style 'commit <12+ chars of
sha1> ("<title line>")'

Please, check patches before submitting.

The commit 21b3edfc9644 ("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.
> 
> The patch provides a minimum mitigation of parameter check.
> 

This patch relates to test number 5.1.1.1.7 in Self Certification Test
(SCT) II Case Specification June 2017.

Fixes: 21b3edfc9644 ("efi_loader: check parameters of CreateEvent")

> 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 */
> +	if (notify_tpl && (is_valid_tpl(notify_tpl) != EFI_SUCCESS))

Thanks for catching this.

The UEFI 2.7 spec has the following parameter description:

NotifyTpl: The task priority level of event notifications, if needed.

CreateEvent is implemented in EDK2 CoreCreateEvent() which calls
CoreCreateEventEx(). The latter has the following test:

  if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) != 0) {
    if (NotifyTpl != TPL_APPLICATION &&
        NotifyTpl != TPL_CALLBACK &&
        NotifyTpl != TPL_NOTIFY) {
      return EFI_INVALID_PARAMETER;
    }
  }

In my patch I missed to check parameter Type first.

Please, change your patch so that it matches what test case 5.1.1.1.7
checks (i.e. the EDK 2 logic).

Best regards

Heinrich

>  		return EFI_INVALID_PARAMETER;
>  
>  	evt = calloc(1, sizeof(struct efi_event));
> 

  parent reply	other threads:[~2018-08-09 12:21 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
2018-08-09 10:38     ` Alexander Graf
2018-08-09 12:21 ` Heinrich Schuchardt [this message]
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=d942b81b-eec7-8662-31fe-d43fcf2248b8@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 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.