Re: [PATCH] selftest/trustedkeys: TPM 1.2 trusted keys test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon Sep 16 19, Sumit Garg wrote:
On Mon, 16 Sep 2019 at 13:19, Jerry Snitselaar <jsnitsel@xxxxxxxxxx> wrote:

On Sun Sep 15 19, Mimi Zohar wrote:
>On Sun, 2019-09-15 at 16:52 -0400, Mimi Zohar wrote:
>> On Fri, 2019-09-13 at 15:08 +0100, Jarkko Sakkinen wrote:
>> > On Wed, Sep 11, 2019 at 08:00:40AM -0400, Mimi Zohar wrote:
>> > > On Tue, 2019-09-10 at 19:24 -0400, Mimi Zohar wrote:
>> > > > On Tue, 2019-09-10 at 19:18 -0400, Mimi Zohar wrote:
>> > > > > Create, save and load trusted keys test
>> > > >
>> > > > Creating trusted keys is failing with the following messages.  Any idea why?
>> > > >
>> > > > [  147.014653] tpm tpm0: A TPM error (34) occurred attempting to a send a command
>> > > > [  147.014678] trusted_key: srkseal failed (-1)
>> > > > [  147.014687] trusted_key: key_seal failed (-1)
>> > >
>> > > This is a regression, that needs to be resolved.  The test works on
>> > > kernels prior to 5.1.
>> >
>> > It breaks on 5.2?
>>
>> No, the regression is in 5.1.
>>
>> >
>> > Can you bisect the failing commit?
>>
>> git bisect start -- drivers/char/tpm/
>> git bisect bad
>> git bisect good v5.0
>>
>> # first bad commit: [412eb585587a1dc43c9622db79de9663b6c4c238] tpm:
>> use tpm_buf in tpm_transmit_cmd() as the IO parameter
>
>In tpm_send(), setting buf.data directly to cmd, instead of calling
>tpm_buf_init() fixes the problem.
>
>Mimi
>
>

The problem is that the command buffer is copied into the tpm_buf with
the memcpy, but after the tpm_transmit_cmd, nothing gets copied back
to be used by the code path that called tpm_send. There is code that
looks at that buffer after trusted_tpm_send returns. Both
security/keys/trusted.c and crypto/asymmetric_keys/asym_tpm.c run into
this.

While playing around with it, adding a memcpy() after the transmit
call worked for me as well as setting buf.data directly instead of the
tpm_buf_init/memcpy/tpm_buf_destroy calls.

I'm wondering if it would be worthwhile to convert the
security/keys/trusted.c and crypto/asymmertic_keys/aym_tpm.c code to
use the same tpm_buf and tpm_buf manipulation code as gets used in
drivers/char/tpm.

This is exactly what patch #2 in this patch-set [1] tries to achieve.

[1] https://lkml.org/lkml/2019/9/16/196

-Sumit

I'll take a look at the patchset today.

Regards,
Jerry





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux