[PATCH 4/4] MODSIGN: check the attributes of db and mok
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Tue, 13 Mar 2018 10:38:03 +0000 (18:38 +0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 1 Dec 2022 06:42:33 +0000 (06:42 +0000)
commitbdbd3ca62a92f83284e9842473f0b1f18f30a873
treed248af5be34c1315c38206979686a72624d39165
parentfd3c8ae133db0de22666bd7bd4f3169a34bd3bbf
[PATCH 4/4] MODSIGN: check the attributes of db and mok

Origin: https://lore.kernel.org/patchwork/patch/933176/

That's better for checking the attributes of db and mok variables
before loading certificates to kernel keyring.

For db and dbx, both of them are authenticated variables. Which
means that they can only be modified by manufacturer's key. So
the kernel should checks EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS
attribute before we trust it.

For mok-rt and mokx-rt, both of them are created by shim boot loader
to forward the mok/mokx content to runtime. They must be runtime-volatile
variables. So kernel should checks that the attributes map did not set
EFI_VARIABLE_NON_VOLATILE bit before we trust it.

Cc: David Howells <dhowells@redhat.com>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
[Rebased by Luca Boccassi]
[bwh: Forward-ported to 5.5.9:
 - get_cert_list() takes a pointer to status and returns the cert list
 - Adjust filename, context]
[bwh: Forward-ported to 5.10: MokListRT and MokListXRT are now both
 loaded through a single code path.]
[bwh: Forward-ported to 5.13: No they aren't]

Gbp-Pq: Topic features/all/db-mok-keyring
Gbp-Pq: Name 0004-MODSIGN-check-the-attributes-of-db-and-mok.patch
security/integrity/platform_certs/load_uefi.c