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>] [day] [month] [year] [list]
Message-ID: <20160407113046.GA12554@intel.com>
Date:	Thu, 7 Apr 2016 14:30:46 +0300
From:	Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:	Christophe Ricard <christophe.ricard@...il.com>
Cc:	Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
	Peter Huewe <peterhuewe@....de>,
	Marcel Selhorst <tpmdd@...horst.net>,
	"moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@...ts.sourceforge.net>,
	open list <linux-kernel@...r.kernel.org>,
	Jean-Luc BLANC <Jean-Luc.Blanc@...com>,
	Benoit HOUYERE <benoit.houyere@...com>
Subject: Re: [PATCH] tpm: remove redundant code from self-test functions

On Wed, Apr 06, 2016 at 04:03:52PM +0200, Christophe Ricard wrote:
>    Hi Jarkko,
> 
>    I think there is a bug in the current version of this patch.
>    tpm1_pcr_read returns TPM status code (>= 0)
> 
>    In tpm_do_selftest, after tpm1_pcr_read, rc is compared with
>    TPM_HEADER_SIZE.
> 
>    In short:
>    "if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {" is never
>    reached because TPM_ERR_DISABLED(0x7) and TPM_ERR_DEACTIVATED(0x6) are <
>    TPM_HEADER size.
>    TPM_HEADER_SIZE beeing already checked in tpm_transmit_cmd, i think a
>    reasonable fix will be to remove:
>    if (rc < TPM_HEADER_SIZE)
>           return -EFAULT;
> 
>    in tpm_do_self_test.
> 
>    Can you merge this fix into the current patch or do you want me to send it
>    to you ?

This is my bad and thanks for catching this. I tested the patch but for
some reason the patch that I sent to LKML does not have this check
removed. The check can be safely removed because the same check is done
internally by tpm_transmit().

For now I removed the patch from my master branch since there is a crash
that I'm debugging and this is low priority change. I'll include this
change among couple of other patches to a patches to a patch set that
unifies all parts to call tpm_transmit_cmd() later on.

Thanks again for spotting this!

/Jarkko

>    Best Regards
>    Christophe
>    2016-04-05 11:42 GMT+02:00 Jarkko Sakkinen
>    <jarkko.sakkinen@...ux.intel.com>:
> 
>      On Fri, Apr 01, 2016 at 09:16:15PM -0600, Jason Gunthorpe wrote:
>      > On Thu, Mar 31, 2016 at 09:37:56AM +0300, Jarkko Sakkinen wrote:
>      > > On Wed, Mar 30, 2016 at 11:46:23PM -0600, Jason Gunthorpe wrote:
>      > > > On Wed, Mar 30, 2016 at 04:20:45PM +0300, Jarkko Sakkinen wrote:
>      > > >
>      > > > > -               rc =
>      be32_to_cpu(cmd.header.out.return_code);
>      > > > >                 if (rc == TPM_ERR_DISABLED || rc ==
>      TPM_ERR_DEACTIVATED) {
>      > > >
>      > > > This line is the entire reason it is open coded, I see it being
>      > > > removed, but I don't see how the functionality is maintained?
>      > >
>      > > When tpm_trance_cmd() returns a positive number it is the TPM error
>      code
>      > > that it returns. tpm_pcr_read() does pass through whatever
>      > > tpm_trace_cmd() returns so the above condition should still work as
>      > > expected.
>      >
>      > Okay, everything looks fine to me
> 
>      I applied this to http://git.infradead.org/users/jjs/linux-tpmdd.git in
>      order to get exposure (tested-by's are always welcome).
> 
>      > Jason
>      /Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ