Re: [RFC PATCH] tpm: Allow the TPM2 pcr_extend HMAC capability to be disabled on boot

Mimi Zohar
2024-11-06T23:53:06Z

On Thu, 2024-11-07 at 01:22 +0200, Jarkko Sakkinen wrote:
> On Thu Nov 7, 2024 at 12:52 AM EET, James Bottomley wrote:
> >
> > I'm a bit confused here. It's TPM2_PCR_Extend we have the trouble with
> > (as Mimi says in her email that you quoted) not TPM2_GetRandom.
> >
> > The random number generator reseed occurs in a kernel thread that fires
> > about once a minute, so it doesn't show up in really any of the boot
> > timings. Plus even with sessions added, what there now isn't a
> > significant overhead even to the running kernel given it's asynchronous
> > and called infrequently.
>
> Ah, right then we need the boot flag, and my earlier comments to the
> parameter apply. I've never used IMA so I don't actually even know in
> detail how it is using TPM.

Huh? A simple explanation is that IMA-measurement maintains a measurement list,
similar to the pre-boot event log. Each IMA-measurement record extends the TPM
PCR (default PCR 10).

Assuming IMA is enabled in the kernel, then just add "ima_policy=tcb" or
"ima_policy=critical_data" on the boot command line. To view the measurement
records, cat <securityfs>/integrity/ima/ascii_runtime_measurements. Normally
the IMA policy specified on the boot command line is replaced with a finer
grained custom policy.

Mimi