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


Groups > linux.kernel > #1458592 > unrolled thread

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

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2016-08-09 12:40 +0200
Last post2016-08-09 17:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-08-09 12:40 +0200
    Re: [PATCH] tpm: fix a race condition tpm2_unseal_trusted() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-08-09 17:50 +0200

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

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-08-09 12:40 +0200
SubjectRe: [PATCH] tpm: fix a race condition tpm2_unseal_trusted()
Message-ID<s4cBY-6kP-21@gated-at.bofh.it>
On Thu, Jul 21, 2016 at 10:25:36AM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 21, 2016 at 12:02:45PM +0300, Jarkko Sakkinen wrote:
> > On Wed, Jul 20, 2016 at 03:13:32PM -0600, Jason Gunthorpe wrote:
> > > 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.
> > 
> > These operations *are not* exposed to kapi. They are interal to the
> > driver. That's why it does not make sense speak about kapi user.
> 
> Right now yes, but look at other subsystems and you will see
> operations like that, because that is typical design pattern. When I
> wrote them I made sure they could be used in that typical way.
> 
> We have issues in our kapi users with regards to hot plug and multiple
> tpms. Fortunately that basically never happens, but it does indicate
> the API is not sufficient..

Functionally my patch should not break anything. I understand the need
for clean up of locking but why doing this now to make the driver
non-racy would make clean up later on any harder?

I would rather think of clean up after the code is non-racy than doing a
huge clean up for racy code. Correct functionality is more important
than clean code because it has direct effect to users.

/Jarkko

[toc] | [next] | [standalone]


#1458870

FromJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date2016-08-09 17:50 +0200
Message-ID<s4hrY-134-29@gated-at.bofh.it>
In reply to#1458592
On Tue, Aug 09, 2016 at 01:36:29PM +0300, Jarkko Sakkinen wrote:

> Functionally my patch should not break anything. I understand the need
> for clean up of locking but why doing this now to make the driver
> non-racy would make clean up later on any harder?

Then rename the functions so they don't confusingly look like the
standard kernel pattern that doesn't lock.

Jason

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web