Re: [RFC PATCH v2 03/13] ima: invalidate unsupported PCR banks

From: James Bottomley
Date: Tue Mar 25 2025 - 11:45:28 EST


On Mon, 2025-03-24 at 21:03 -0400, Mimi Zohar wrote:
> On Sun, 2025-03-23 at 17:18 -0400, James Bottomley wrote:
[...]
> > Instead of any of that, why not do what the TCG tells us to do for
> > unsupported banks and simply cap them with 0xffffffff record
> > EV_SEPARATOR and stop extending to them? (note this would probably
> > require defining a separator event for IMA)
>
> open-writers and ToMToU integrity violations are added to the IMA
> measurement list as 0x00's, but are extended into the TPM using
> 0xFF's.  Unfortunately, as mentioned previously, some verifiers
> ignore these integrity violations by automatically replacing the
> 0x00's with 0xFF's.

That sounds like something that should be fixed ...

> What do you mean by "simply cap" them?  Does it automatically prevent
> the PCR from being extended?  If not, then this patch set is doing
> exactly that - preventing the TPM bank from additional extends.

The idea of separators as understood by the TCG (the EV_SEPARATOR
event) is that they divide the log up into different phases. If you
see a measurement belonging to a prior phase after a separator you know
some violation has occurred, even if the log itself verifies. The
point being that if you log a separator in the last phase of boot (and
for IMA logs there only is a single phase) there can be no more valid
measurements after that event because of the separator, so the PCR is
termed capped, meaning you can't validly extend to it and if you do the
verifier shows a violation.

Regards,

James