From: Lukas Wunner <lukas@wunner.de>
To: David Howells <dhowells@redhat.com>
Cc: matt@codeblueprint.co.uk, ard.biesheuvel@linaro.org,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org, keyrings@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 5/8] efi: Get the secure boot status [ver #5]
Date: Thu, 8 Dec 2016 07:57:35 +0100 [thread overview]
Message-ID: <20161208065735.GB8549@wunner.de> (raw)
In-Reply-To: <148111671977.23390.12452925207541146423.stgit@warthog.procyon.org.uk>
On Wed, Dec 07, 2016 at 01:18:39PM +0000, David Howells wrote:
> @@ -226,7 +180,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
> efi_guid_t loaded_image_proto = LOADED_IMAGE_PROTOCOL_GUID;
> unsigned long reserve_addr = 0;
> unsigned long reserve_size = 0;
> - int secure_boot = 0;
> + enum efi_secureboot_mode secure_boot = efi_secureboot_mode_unknown;
You're setting this variable unconditionally further down, so no need
to initialize it.
> +/*
> + * Determine whether we're in secure boot mode. We return:
> + */
We return? Looks like something's missing here.
> +enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg)
> +{
> + u8 secboot, setupmode;
> + unsigned long size;
> + efi_status_t status;
> +
> + size = sizeof(secboot);
> + status = get_efi_var(efi_SecureBoot_name, &efi_variable_guid,
> + NULL, &size, &secboot);
> + if (status != EFI_SUCCESS)
> + goto out_efi_err;
> +
> + size = sizeof(setupmode);
> + status = get_efi_var(efi_SetupMode_name, &efi_variable_guid,
> + NULL, &size, &setupmode);
> + if (status != EFI_SUCCESS)
> + goto out_efi_err;
> +
> + if (secboot == 0 || setupmode == 1)
> + goto secure_boot_disabled;
Well, you could just return efi_secureboot_mode_disabled directly here
instead of doing a jump.
> +
> + pr_efi(sys_table_arg, "UEFI Secure Boot is enabled.\n");
> + return efi_secureboot_mode_enabled;
> +
> +secure_boot_disabled:
> + return efi_secureboot_mode_disabled;
> +
> +out_efi_err:
> + pr_efi_err(sys_table_arg, "Could not determine UEFI Secure Boot status.\n");
> + if (status == EFI_NOT_FOUND)
> + goto secure_boot_disabled;
> + return efi_secureboot_mode_unknown;
> +}
Thanks,
Lukas
next prev parent reply other threads:[~2016-12-08 6:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 13:18 [PATCH 0/8] efi: Pass secure boot mode to kernel [ver #5] David Howells
2016-12-07 13:18 ` [PATCH 1/8] efi: use typed function pointers for runtime services table " David Howells
2016-12-07 13:18 ` [PATCH 2/8] x86/efi: Allow invocation of arbitrary runtime services " David Howells
2016-12-07 13:18 ` [PATCH 3/8] arm/efi: " David Howells
2016-12-07 13:18 ` [PATCH 4/8] efi: Add SHIM and image security database GUID definitions " David Howells
2016-12-07 13:18 ` [PATCH 5/8] efi: Get the secure boot status " David Howells
2016-12-08 6:57 ` Lukas Wunner [this message]
2016-12-08 8:16 ` David Howells
2016-12-08 12:42 ` Lukas Wunner
2016-12-08 17:31 ` David Howells
2016-12-09 0:35 ` Lukas Wunner
2016-12-07 13:18 ` [PATCH 6/8] efi: Disable secure boot if shim is in insecure mode " David Howells
2016-12-07 13:18 ` [PATCH 7/8] efi: Add EFI_SECURE_BOOT bit " David Howells
2016-12-07 13:19 ` [PATCH 8/8] efi: Handle secure boot from UEFI-2.6 " David Howells
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=20161208065735.GB8549@wunner.de \
--to=lukas@wunner.de \
--cc=ard.biesheuvel@linaro.org \
--cc=dhowells@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
/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