[PATCH 2/6][B] efi: Restrict efivar_ssdt_load when the kernel is locked down
Seth Forshee
seth.forshee at canonical.com
Fri Jun 19 12:48:29 UTC 2020
From: Matthew Garrett <matthewgarrett at google.com>
BugLink: https://bugs.launchpad.net/bugs/1884159
efivar_ssdt_load allows the kernel to import arbitrary ACPI code from an
EFI variable, which gives arbitrary code execution in ring 0. Prevent
that when the kernel is locked down.
Signed-off-by: Matthew Garrett <mjg59 at google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Reviewed-by: Kees Cook <keescook at chromium.org>
Cc: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Cc: linux-efi at vger.kernel.org
Signed-off-by: James Morris <jmorris at namei.org>
(backported from commit 1957a85b0032a81e6482ca4aab883643b8dae06e)
Signed-off-by: Seth Forshee <seth.forshee at canonical.com>
---
drivers/firmware/efi/efi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 4b4dd5532725..ed4f03dbecfd 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -228,6 +228,11 @@ static void generic_ops_unregister(void)
static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
static int __init efivar_ssdt_setup(char *str)
{
+ bool locked_down = kernel_is_locked_down("modifying ACPI tables");
+
+ if (locked_down)
+ return -EPERM;
+
if (strlen(str) < sizeof(efivar_ssdt))
memcpy(efivar_ssdt, str, strlen(str));
else
--
2.27.0
More information about the kernel-team
mailing list