]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pcrlock: log if we generate an "empty" policy
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Sep 2024 09:44:02 +0000 (11:44 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 11 Sep 2024 13:14:22 +0000 (15:14 +0200)
Such a policy won't provide any protection, but it's still entirely fine
to have it like this in various contexts, for example at OS install
time, to allocate the nvindex and reference it in enrollments. However,
it does deserve mention, hence log about it at LOG_NOTICE level.

This is based on a similar patch by Arnaud Patard
<arnaud.patard@collabora.com> proposed at #33663.

src/pcrlock/pcrlock.c

index 21d83801d98f75fb8224d49954fcd3fd968f1d5b..46e971f4bfe5259dc31474d68db184555e736fa6 100644 (file)
@@ -4438,6 +4438,9 @@ static int make_policy(bool force, RecoveryPinMode recovery_pin_mode) {
         if (r < 0)
                 return r;
 
+        if (!force && new_prediction.pcrs == 0)
+                log_notice("Set of PCRs to use for policy is empty. Generated policy will not provide any protection in its current form. Proceeding.");
+
         usec_t predict_start_usec = now(CLOCK_MONOTONIC);
 
         r = tpm2_pcr_prediction_run(el, &new_prediction);