Skip to content

Commit de91657

Browse files
committed
SBAT: mirror SBAT to SbatRT and extend to PCR7 + log
This adds SBAT to our table of variables to mirror with our MoK state. Currently it mirrors "SBAT" to a variable named "SbatRT", both using the SHIM GUID. Currently we enforce the current policy WRT these variables: - we always delete SbatRT if it's present, for a couple of reasons: - If we got here either something created it before us during boot, which isn't a thing we believe anything should be doing, or it's an NV variable, which it shouldn't be. - we want to raise the error if it's NV+Authenticated - we always delete SBAT (and do not mirror it) if it either - doesn't have BS|NV set or - does have RT set - we're requiring !RT because we can't actually tell if it's an authenticated variable or not, and we want to get the error if RT is set and it is authenticated, because that means we've lost the race between us and an attacker to create it. - we always measure SBAT into PCR7 and add a log extension with the measured hash Signed-off-by: Peter Jones <[email protected]>
1 parent 80ff175 commit de91657

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.tpm

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PCR7:
1919
- shim_cert - shim's build-time generated allowlist, logged as "Shim"
2020
- MokSBState will be extended into PCR7 if it is set, logged as
2121
"MokSBState".
22+
- SBAT will be extended into PCR7 if it is set, logged as "SBAT"
2223

2324
PCR8:
2425
- If you're using the grub2 TPM patchset we cary in Fedora, the kernel command

mok.c

+16
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,22 @@ struct mok_state_variable mok_state_variables[] = {
229229
.no_attr = EFI_VARIABLE_RUNTIME_ACCESS,
230230
.state = &ignore_db,
231231
},
232+
{.name = L"SBAT",
233+
.name8 = "SBAT",
234+
.rtname = L"SbatRT",
235+
.rtname8 = "SbatRT",
236+
.guid = &SHIM_LOCK_GUID,
237+
.yes_attr = EFI_VARIABLE_BOOTSERVICE_ACCESS |
238+
EFI_VARIABLE_NON_VOLATILE,
239+
/*
240+
* we're enforcing that SBAT can't have an RT flag here because
241+
* there's no way to tell whether it's an authenticated variable.
242+
*/
243+
.no_attr = EFI_VARIABLE_RUNTIME_ACCESS,
244+
.flags = MOK_MIRROR_DELETE_FIRST |
245+
MOK_VARIABLE_MEASURE,
246+
.pcr = 7,
247+
},
232248
{ NULL, }
233249
};
234250

0 commit comments

Comments
 (0)