Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1447480

Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted()

From Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted()
Date 2016-07-20 23:20 +0200
Message-ID <rX74l-6Go-1@gated-at.bofh.it> (permalink)
References <rWNoZ-2vg-5@gated-at.bofh.it> <rX2R3-3Qq-5@gated-at.bofh.it> <rX6KZ-6hA-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jul 20, 2016 at 11:53:14PM +0300, Jarkko Sakkinen wrote:

> The only use cases I see at the moment for it work this way:
> 
> 1. Call tpm_try_get_ops.
> 2. Send a TPM command.
> 3. Call tpm_put_ops.

Right, but that is just a reflection of what the in kernel users are
doing today, not necessarily what they should be doing.

We should not break the put/get semantics..

> I did not find any other form of use. The only use is to make sure that
> there are no transactions running before the ops are cleared. Or did I
> overlook something perhaps?

The put/get is intended to allow a kapi user to hold a ref to tpm
without it geting destroyed. It is not intended to be an exclusive lock.

> Trusted key unseal operation with TPM2 is broken into two operations:
> 
> 1. Load the given key blob.
> 2. Unseal the data.
> 
> Without locking and unlocking mutex only once there is a race condition.

Well, the race condition is fundamentally because we don't have key
virtualization in the kernel :|

Those sorts of compound ops should hold the tpm_mutex manually, not
through the get_ops scheme.

Jason

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 02:20 +0200
  Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-20 18:50 +0200
    Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 23:00 +0200
      Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-20 23:20 +0200
        Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-21 11:10 +0200
          Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-21 18:30 +0200

csiph-web