Skip to content

Commit 1573d59

Browse files
esnowbergSasha Levin
authored andcommitted
integrity: Load mokx variables into the blacklist keyring
[ Upstream commit ebd9c2a ] During boot the Secure Boot Forbidden Signature Database, dbx, is loaded into the blacklist keyring. Systems booted with shim have an equivalent Forbidden Signature Database called mokx. Currently mokx is only used by shim and grub, the contents are ignored by the kernel. Add the ability to load mokx into the blacklist keyring during boot. Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com> Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> cc: keyrings@vger.kernel.org Link: https://lore.kernel.org/r/c33c8e3839a41e9654f41cc92c7231104931b1d7.camel@HansenPartnership.com/ Link: https://lore.kernel.org/r/20210122181054.32635-5-eric.snowberg@oracle.com/ # v5 Link: https://lore.kernel.org/r/161428674320.677100.12637282414018170743.stgit@warthog.procyon.org.uk/ Link: https://lore.kernel.org/r/161433313205.902181.2502803393898221637.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/161529607422.163428.13530426573612578854.stgit@warthog.procyon.org.uk/ # v3 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c6ae6f8 commit 1573d59

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

security/integrity/platform_certs/load_uefi.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ static int __init load_moklist_certs(void)
132132
static int __init load_uefi_certs(void)
133133
{
134134
efi_guid_t secure_var = EFI_IMAGE_SECURITY_DATABASE_GUID;
135-
void *db = NULL, *dbx = NULL;
136-
unsigned long dbsize = 0, dbxsize = 0;
135+
efi_guid_t mok_var = EFI_SHIM_LOCK_GUID;
136+
void *db = NULL, *dbx = NULL, *mokx = NULL;
137+
unsigned long dbsize = 0, dbxsize = 0, mokxsize = 0;
137138
efi_status_t status;
138139
int rc = 0;
139140

@@ -175,6 +176,21 @@ static int __init load_uefi_certs(void)
175176
kfree(dbx);
176177
}
177178

179+
mokx = get_cert_list(L"MokListXRT", &mok_var, &mokxsize, &status);
180+
if (!mokx) {
181+
if (status == EFI_NOT_FOUND)
182+
pr_debug("mokx variable wasn't found\n");
183+
else
184+
pr_info("Couldn't get mokx list\n");
185+
} else {
186+
rc = parse_efi_signature_list("UEFI:MokListXRT",
187+
mokx, mokxsize,
188+
get_handler_for_dbx);
189+
if (rc)
190+
pr_err("Couldn't parse mokx signatures %d\n", rc);
191+
kfree(mokx);
192+
}
193+
178194
/* Load the MokListRT certs */
179195
rc = load_moklist_certs();
180196

0 commit comments

Comments
 (0)