diff options
author | Lee, Chun-Yi <joeyli.kernel@gmail.com> | 2021-12-18 10:09:05 +0800 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2021-12-24 10:25:24 -0500 |
commit | 92ad19559ea9a8ec6f158480934ae26ebfe2c14f (patch) | |
tree | 7cab118eacabaecc222cbc63040de48a016005ee /security | |
parent | 54bf7fa3efd08eea03e4bac04e188ee3db6173a7 (diff) | |
download | linux-92ad19559ea9a8ec6f158480934ae26ebfe2c14f.tar.bz2 |
integrity: Do not load MOK and MOKx when secure boot be disabled
The security of Machine Owner Key (MOK) relies on secure boot. When
secure boot is disabled, EFI firmware will not verify binary code. Then
arbitrary efi binary code can modify MOK when rebooting.
This patch prevents MOK/MOKx be loaded when secure boot be disabled.
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/integrity/platform_certs/load_uefi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c index f290f78c3f30..08b6d12f99b4 100644 --- a/security/integrity/platform_certs/load_uefi.c +++ b/security/integrity/platform_certs/load_uefi.c @@ -6,6 +6,7 @@ #include <linux/err.h> #include <linux/efi.h> #include <linux/slab.h> +#include <linux/ima.h> #include <keys/asymmetric-type.h> #include <keys/system_keyring.h> #include "../integrity.h" @@ -176,6 +177,10 @@ static int __init load_uefi_certs(void) kfree(dbx); } + /* the MOK/MOKx can not be trusted when secure boot is disabled */ + if (!arch_ima_get_secureboot()) + return 0; + mokx = get_cert_list(L"MokListXRT", &mok_var, &mokxsize, &status); if (!mokx) { if (status == EFI_NOT_FOUND) |