efi-loader: move $SYSTEMD_FORCE_MEASURE override to efi_measured_os()

Follow-up for cd911bec6e

The (debug) envvar should have highest priority, hence move it
to the new entrypoint function and give it precedence over
systemd.tpm2_measured_os=.
This commit is contained in:
Mike Yuan
2026-07-25 19:37:47 +09:00
committed by Yu Watanabe
parent b82e739cb5
commit 89d48b71ae
+7 -7
View File
@@ -281,13 +281,6 @@ int efi_measured_uki(int log_level) {
* being used, but it measured things into a different PCR than we are configured for in
* userspace. (i.e. we expect PCR 11 being used for this by both sd-stub and us) */
r = secure_getenv_bool("SYSTEMD_FORCE_MEASURE"); /* Give user a chance to override the variable test,
* for debugging purposes */
if (r >= 0)
return (cached = r);
if (r != -ENXIO)
log_debug_errno(r, "Failed to parse $SYSTEMD_FORCE_MEASURE, ignoring: %m");
if (!efi_has_tpm2())
return (cached = 0);
@@ -323,6 +316,13 @@ int efi_measured_os(int log_level) {
if (cached >= 0)
return cached;
r = secure_getenv_bool("SYSTEMD_FORCE_MEASURE"); /* Give user a chance to override the variable test,
* for debugging purposes */
if (r >= 0)
return (cached = r);
if (r != -ENXIO)
log_debug_errno(r, "Failed to parse $SYSTEMD_FORCE_MEASURE, ignoring: %m");
bool b;
r = proc_cmdline_get_bool("systemd.tpm2_measured_os", /* flags= */ 0, &b);
if (r > 0)