On Tue, 2018-02-20 at 15:30 +0200, Jarkko Sakkinen wrote: > On Fri, 2018-02-16 at 10:17 -0800, James Bottomley wrote: > > > > so I think it's something to do with tpm_validate_command. I > > think, perhaps, we shouldn't call the getcaps for the command codes > > until the self test is over, but I need to do more debugging to > > track down what's going on. > > The calls for tpm2_get_pcr_allocation() and tpm2_get_cc_attrs_tbl() > could be also moved before the self test. That's not a good idea for a couple of reasons 1. You really should do as little as possible with the TPM before the self test 2. The TPM might not be started before the self test, so it would error all commands with TPM_RC_INITIALIZE anyway (this was the problem with the initial version of the patch set). So self test should be the first command we send to the TPM. The only reason I was suspicious of tpm_validate_command() is because it can manufacture a TPM_RC_COMMAND_CODE return. However, that turned out not to be the case (and tpm_validate_command() has a bypass for sending everything to the TPM before the attribute table is initialized, so it's all working correctly). James