linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/ima: Check EFI_RUNTIME_SERVICES before using
@ 2019-04-23 22:48 Scott Wood
  2019-04-25 12:17 ` Mimi Zohar
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Wood @ 2019-04-23 22:48 UTC (permalink / raw)
  To: Mimi Zohar, Dmitry Kasatkin; +Cc: linux-integrity, linux-rt-users, Scott Wood

Checking efi_enabled(EFI_BOOT) is not sufficient to ensure that
EFI runtime services are available, e.g. if efi=noruntime is used.

Without this, I get an oops on a PREEMPT_RT kernel where efi=noruntime is
the default.

Fixes: 399574c64eaf94e8 ("x86/ima: retry detecting secure boot mode")
Signed-off-by: Scott Wood <swood@redhat.com>
---
 arch/x86/kernel/ima_arch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/ima_arch.c b/arch/x86/kernel/ima_arch.c
index e47cd9390ab4..2a2e87717bad 100644
--- a/arch/x86/kernel/ima_arch.c
+++ b/arch/x86/kernel/ima_arch.c
@@ -17,6 +17,11 @@ static enum efi_secureboot_mode get_sb_mode(void)
 
 	size = sizeof(secboot);
 
+	if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
+		pr_info("ima: secureboot mode unknown, no efi\n");
+		return efi_secureboot_mode_unknown;
+	}
+
 	/* Get variable contents into buffer */
 	status = efi.get_variable(efi_SecureBoot_name, &efi_variable_guid,
 				  NULL, &size, &secboot);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/ima: Check EFI_RUNTIME_SERVICES before using
  2019-04-23 22:48 [PATCH] x86/ima: Check EFI_RUNTIME_SERVICES before using Scott Wood
@ 2019-04-25 12:17 ` Mimi Zohar
  0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2019-04-25 12:17 UTC (permalink / raw)
  To: Scott Wood, Dmitry Kasatkin; +Cc: linux-integrity, linux-rt-users

On Tue, 2019-04-23 at 17:48 -0500, Scott Wood wrote:
> Checking efi_enabled(EFI_BOOT) is not sufficient to ensure that
> EFI runtime services are available, e.g. if efi=noruntime is used.
> 
> Without this, I get an oops on a PREEMPT_RT kernel where efi=noruntime is
> the default.
> 
> Fixes: 399574c64eaf94e8 ("x86/ima: retry detecting secure boot mode")
> Signed-off-by: Scott Wood <swood@redhat.com>

Thanks!

> ---
>  arch/x86/kernel/ima_arch.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/x86/kernel/ima_arch.c b/arch/x86/kernel/ima_arch.c
> index e47cd9390ab4..2a2e87717bad 100644
> --- a/arch/x86/kernel/ima_arch.c
> +++ b/arch/x86/kernel/ima_arch.c
> @@ -17,6 +17,11 @@ static enum efi_secureboot_mode get_sb_mode(void)
>  
>  	size = sizeof(secboot);
>  
> +	if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
> +		pr_info("ima: secureboot mode unknown, no efi\n");
> +		return efi_secureboot_mode_unknown;
> +	}
> +
>  	/* Get variable contents into buffer */
>  	status = efi.get_variable(efi_SecureBoot_name, &efi_variable_guid,
>  				  NULL, &size, &secboot);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-25 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-23 22:48 [PATCH] x86/ima: Check EFI_RUNTIME_SERVICES before using Scott Wood
2019-04-25 12:17 ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).