Message ID | 20180810063632.10979-1-takahiro.akashi@linaro.org |
---|---|
State | Accepted |
Commit | 3748ed908fd478b36bf698839632b2514c450513 |
Headers | show |
Series | efi_loader: fix a parameter check at CreateEvent() | expand |
On 08/10/2018 08:36 AM, AKASHI Takahiro wrote: > The commit 21b3edfc9644 ("efi_loader: check parameters of CreateEvent") > enforces a strict parameter check at CreateEvent(). On the other hand, > UEFI specification version 2.7, section 7.1, says: > > The EVT_NOTIFY_WAIT and EVT_NOTIFY_SIGNAL flags are exclusive. If > neither flag is specified, the caller does not require any notification > concerning the event and the NotifyTpl, NotifyFunction, and > NotifyContext parameters are ignored. > > So the check should be mitigated so as to comply with the specification. > Without this patch, EDK2's Shell.efi won't be started. > > 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 ac8f484507bd..f3fba3190981 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) > + if ((type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) && > + (is_valid_tpl(notify_tpl) != EFI_SUCCESS)) > return EFI_INVALID_PARAMETER; > > evt = calloc(1, sizeof(struct efi_event)); > @Alex: Please, add this to the pull request for rc2. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ac8f484507bd..f3fba3190981 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) + if ((type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) && + (is_valid_tpl(notify_tpl) != EFI_SUCCESS)) return EFI_INVALID_PARAMETER; evt = calloc(1, sizeof(struct efi_event));
The commit 21b3edfc9644 ("efi_loader: check parameters of CreateEvent") enforces a strict parameter check at CreateEvent(). On the other hand, UEFI specification version 2.7, section 7.1, says: The EVT_NOTIFY_WAIT and EVT_NOTIFY_SIGNAL flags are exclusive. If neither flag is specified, the caller does not require any notification concerning the event and the NotifyTpl, NotifyFunction, and NotifyContext parameters are ignored. So the check should be mitigated so as to comply with the specification. Without this patch, EDK2's Shell.efi won't be started. 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(-)