diff options
author | Scott Wood <swood@redhat.com> | 2019-04-24 00:48:07 +0200 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2019-05-20 02:27:12 +0200 |
commit | 558b523d46289f111d53d7c42211069063be5985 (patch) | |
tree | 5c00e16c30f325b0da8d00106318403ad1cb5a15 /arch/x86 | |
parent | Linux 5.2-rc1 (diff) | |
download | linux-558b523d46289f111d53d7c42211069063be5985.tar.xz linux-558b523d46289f111d53d7c42211069063be5985.zip |
x86/ima: Check EFI_RUNTIME_SERVICES before using
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")
Cc: stable@vger.kernel.org (linux-5.0)
Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/ima_arch.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/ima_arch.c b/arch/x86/kernel/ima_arch.c index 85de790583f9..64b973f0e985 100644 --- a/arch/x86/kernel/ima_arch.c +++ b/arch/x86/kernel/ima_arch.c @@ -18,6 +18,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); |