Re: [PATCH] tpm: Detach page allocation from tpm_buf
From: Mimi Zohar
Date: Thu Oct 03 2019 - 08:39:22 EST
On Thu, 2019-10-03 at 14:32 +0300, Jarkko Sakkinen wrote:
> On Wed, Oct 02, 2019 at 08:40:24AM -0400, Mimi Zohar wrote:
> > On Thu, 2019-09-26 at 16:12 +0300, Jarkko Sakkinen wrote:
> > > On Thu, Sep 26, 2019 at 03:46:35PM +0300, Jarkko Sakkinen wrote:
> > > > On Wed, Sep 25, 2019 at 04:48:41PM +0300, Jarkko Sakkinen wrote:
> > > > > - tpm_buf_reset(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_RANDOM);
> > > > > + tpm_buf_reset(&buf, data_ptr, PAGE_SIZE,
> > > > > + TPM2_ST_NO_SESSIONS, TPM2_CC_PCR_EXTEND);
> > > >
> > > > Oops.
> > >
> > > Maybe we could use random as the probe for TPM version since we anyway
> > > send a TPM command as a probe for TPM version:
> > >
> > > 1. Try TPM2 get random.
> > > 2. If fail, try TPM1 get random.
> > > 3. Output random number to klog.
> > >
> > > Something like 8 bytes would be sufficient. This would make sure that
> > > no new change breaks tpm_get_random() and also this would give some
> > > feedback that TPM is at least somewhat working.
> >
> > That involves sending 2 TPM commands. ÂAt what point does this occur?
> > ÂOn registration? ÂWhenever getting a random number? ÂIs the result
> > cached in chip->flags?
>
> On registeration. It is just printed to klog.
What sets "TPM_CHIP_FLAG_TPM2" in chip->flags? ÂAnd when?
>
> > Will this delay the TPM initialization, causing IMA to go into "TPM
> > bypass mode"?
>
> Of course it will delay the init.
Delaying the init will most likely cause regressions on systems with
TPM 1.2 systems.
Instead of sending the TPM 2.0 command and on failure sending the TPM
1.2 version of the command, could chip->flags be tested? ÂAnd if not
chip->flags, then provide the TPM version as part of registration.
>
> As I've stated before the real fix for the bypass issue would be
> to make TPM as part of the core but this has not received much
> appeal. I think I've sent patch for this once.
I must have missed this discussion.
Mimi