From patchwork Thu Aug 9 06:15:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 955365 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Y2AC86h1"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41mJ1p5yX4z9ryt for ; Thu, 9 Aug 2018 16:16:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 001C4C21DA1; Thu, 9 Aug 2018 06:16:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F0767C21C27; Thu, 9 Aug 2018 06:16:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 23F06C21BE5; Thu, 9 Aug 2018 06:16:49 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by lists.denx.de (Postfix) with ESMTPS id E707AC21C27 for ; Thu, 9 Aug 2018 06:16:47 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id z8-v6so2237798pgu.8 for ; Wed, 08 Aug 2018 23:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yaMqqVPpvJ6TfMPntrdjj4AwixY/HY0Ri/mgO37WBQw=; b=Y2AC86h1mF3ZYOBQnsXfmvqmTkINnksj+S5SaUwspPHEb51OPJqnU5RvM+icsEGjWe mpXNw8WygNoW3I6Df8h+RADZwCASVcmsRPT832RbH9+snHhZ0hZgbsXQIbWOfT96h4xv UPmzoIhwlMLCkUeVtdOYJ7BhMd8S7LnX+BsF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yaMqqVPpvJ6TfMPntrdjj4AwixY/HY0Ri/mgO37WBQw=; b=galxrj7ZtrrDK4avHs6TDhQpVO0fwYNmlSMWI161Lfsn59v35NbUcmQCieG9WCC9SF 4bgfIwVuz8piNHsZuQfE+PUNVZNSeD8eFl522fQb00A5Dvd0voydIXHZB8JdI8yrwXX2 AC5ZysdRibsLazkMghw86jvvfzsXnlDw21FqwIVglFV05porqSUvEeG7CZYQHBAglL2P u68twi4ookQ8OlcKxyNFqoWneT6Ev9jD69Ki4N2Wppt5Lp6cFqCn7TJfpyecUh72gDWH Dj7+d5Ay/8Yxmh1V8FijMqFmMptneNMoa1ghAsCA8+EUK9bf5sogqwyuppPIWjWXYaFE oOXg== X-Gm-Message-State: AOUpUlHe8W8NTqMFSM685IkERB6vQAvqSerBdiFsw4trDZsCfMPwnBBC ZTMed1AlTLmBQ0q5MykjuagXbQ== X-Google-Smtp-Source: AA+uWPw5cqhjRDdXrWYTQiHpxTdSby5ymErs8ntnc+QDydAq+Oo4Plzs20z7Xr2sPmHR32wKsNkXtA== X-Received: by 2002:a63:790b:: with SMTP id u11-v6mr791150pgc.111.1533795406391; Wed, 08 Aug 2018 23:16:46 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id y69-v6sm17907817pfd.36.2018.08.08.23.16.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 23:16:45 -0700 (PDT) From: AKASHI Takahiro To: agraf@suse.de Date: Thu, 9 Aug 2018 15:15:38 +0900 Message-Id: <20180809061538.6624-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [RFC] efi_loader: workaround for EDK2's shell.efi X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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. The patch provides a minimum mitigation of parameter check. Signed-off-by: AKASHI Takahiro --- 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)) return EFI_INVALID_PARAMETER; evt = calloc(1, sizeof(struct efi_event));