lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181119123844.GA8755@linux.intel.com>
Date:   Mon, 19 Nov 2018 14:38:44 +0200
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        James Bottomley <James.Bottomley@...senPartnership.com>,
        Tomas Winkler <tomas.winkler@...el.com>,
        Tadeusz Struk <tadeusz.struk@...el.com>,
        Stefan Berger <stefanb@...ux.vnet.ibm.com>,
        Nayna Jain <nayna@...ux.ibm.com>,
        Peter Huewe <peterhuewe@....de>, Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 14/17] tpm: remove TPM_TRANSMIT_UNLOCKED flag

On Sun, Nov 18, 2018 at 12:51:04PM -0700, Jason Gunthorpe wrote:
> On Sun, Nov 18, 2018 at 02:47:47PM +0200, Jarkko Sakkinen wrote:
> > Added locking as part of tpm_try_get_ops() and tpm_put_ops() as they are
> > anyway used in most of the call sites except in tpmrm_release() where we
> > take the locks manually.
> > 
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
> > Reviewed-by: Stefan Berger <stefanb@...ux.ibm.com>
> > ---
> >  drivers/char/tpm/tpm-chip.c       |  2 ++
> >  drivers/char/tpm/tpm-dev-common.c |  4 +---
> >  drivers/char/tpm/tpm-interface.c  |  8 --------
> >  drivers/char/tpm/tpm.h            |  8 ++------
> >  drivers/char/tpm/tpm2-cmd.c       | 13 ++++---------
> >  drivers/char/tpm/tpm2-space.c     | 15 ++++++---------
> >  6 files changed, 15 insertions(+), 35 deletions(-)
>  
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index 32db84683c40..157505b0f755 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -58,6 +58,7 @@ int tpm_try_get_ops(struct tpm_chip *chip)
> >  	if (!chip->ops)
> >  		goto out_lock;
> >  
> > +	mutex_lock(&chip->tpm_mutex);
> >  	return 0;
> 
> It really isn't appropriate for something called 'get' to be exclusive
> like this.. Call it tpm_try_lock_ops() ?

Would definitely be appropriate to rename it, yes.

> > diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c
> > index c7dc54930576..582caefcf19b 100644
> > --- a/drivers/char/tpm/tpm-dev-common.c
> > +++ b/drivers/char/tpm/tpm-dev-common.c
> > @@ -33,7 +33,6 @@ static ssize_t tpm_dev_transmit(struct tpm_chip *chip, struct tpm_space *space,
> >  	struct tpm_header *header = (void *)buf;
> >  	ssize_t ret, len;
> >  
> > -	mutex_lock(&chip->tpm_mutex);
> 
> The now implicit locking should be tested for using lockdep calls in
> all places that assume the lock is held by the caller.

Yes. Most importantly trusted keys and IMA should be tested with lockdep
turned on.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ