All of lore.kernel.org
 help / color / mirror / Atom feed
From: boris.ostrovsky@oracle.com
To: Ard Biesheuvel <ardb@kernel.org>, linux-efi@vger.kernel.org
Cc: xen-devel@lists.xenproject.org, sstabellini@kernel.org, jgross@suse.com
Subject: Re: [PATCH] efi: x86/xen: switch to efi_get_secureboot_mode helper
Date: Wed, 4 Nov 2020 18:53:50 -0500	[thread overview]
Message-ID: <f3d902ca-3fa2-aa8a-fb9a-0891b9567751@oracle.com> (raw)
In-Reply-To: <20201104221400.7005-1-ardb@kernel.org>


On 11/4/20 5:14 PM, Ard Biesheuvel wrote:
> Now that we have a static inline helper to discover the platform's secure
> boot mode that can be shared between the EFI stub and the kernel proper,
> switch to it, and drop some comments about keeping them in sync manually.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/x86/xen/efi.c                        | 37 +++++---------------
>  drivers/firmware/efi/libstub/secureboot.c |  3 --
>  2 files changed, 9 insertions(+), 31 deletions(-)
>
> diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
> index 205a9bc981b0..a27444acaf1e 100644
> --- a/arch/x86/xen/efi.c
> +++ b/arch/x86/xen/efi.c
> @@ -93,37 +93,22 @@ static efi_system_table_t __init *xen_efi_probe(void)
>  
>  /*
>   * Determine whether we're in secure boot mode.
> - *
> - * Please keep the logic in sync with
> - * drivers/firmware/efi/libstub/secureboot.c:efi_get_secureboot().
>   */
>  static enum efi_secureboot_mode xen_efi_get_secureboot(void)
>  {
> -	static efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
>  	static efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID;
> +	enum efi_secureboot_mode mode;
>  	efi_status_t status;
> -	u8 moksbstate, secboot, setupmode;
> +	u8 moksbstate;
>  	unsigned long size;
>  
> -	size = sizeof(secboot);
> -	status = efi.get_variable(L"SecureBoot", &efi_variable_guid,
> -				  NULL, &size, &secboot);
> -
> -	if (status == EFI_NOT_FOUND)
> -		return efi_secureboot_mode_disabled;
> -
> -	if (status != EFI_SUCCESS)
> -		goto out_efi_err;
> -
> -	size = sizeof(setupmode);
> -	status = efi.get_variable(L"SetupMode", &efi_variable_guid,
> -				  NULL, &size, &setupmode);
> -
> -	if (status != EFI_SUCCESS)
> -		goto out_efi_err;
> -
> -	if (secboot == 0 || setupmode == 1)
> -		return efi_secureboot_mode_disabled;
> +	mode = efi_get_secureboot_mode(efi.get_variable);


Which tree is this patch against? I don't see a definition of efi_get_secureboot_mode().


> +	if (mode == efi_secureboot_mode_unknown) {
> +		efi_err("Could not determine UEFI Secure Boot status.\n");


We need to include drivers/firmware/efi/libstub/efistub.h for that. Which I am not sure is meant to be included anywhere outside of libstub.


-boris



  reply	other threads:[~2020-11-04 23:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 22:14 [PATCH] efi: x86/xen: switch to efi_get_secureboot_mode helper Ard Biesheuvel
2020-11-04 23:53 ` boris.ostrovsky [this message]
2020-11-04 23:54   ` Ard Biesheuvel

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=f3d902ca-3fa2-aa8a-fb9a-0891b9567751@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=ardb@kernel.org \
    --cc=jgross@suse.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.