From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Christophe Ricard <christophe.ricard@gmail.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
Peter Huewe <peterhuewe@gmx.de>,
Marcel Selhorst <tpmdd@selhorst.net>,
"moderated list:TPM DEVICE DRIVER"
<tpmdd-devel@lists.sourceforge.net>,
open list <linux-kernel@vger.kernel.org>,
Jean-Luc BLANC <Jean-Luc.Blanc@st.com>,
Benoit HOUYERE <benoit.houyere@st.com>
Subject: Re: [PATCH] tpm: remove redundant code from self-test functions
Date: Thu, 7 Apr 2016 14:30:46 +0300 [thread overview]
Message-ID: <20160407113046.GA12554@intel.com> (raw)
In-Reply-To: <CALD+uuwQnvKL7TsiBXme=P8NKEX2gD1mOx-AxV7OHiBgmi4ykw@mail.gmail.com>
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@linux.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
next prev parent reply other threads:[~2016-04-07 11:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 13:20 [PATCH] tpm: remove redundant code from self-test functions Jarkko Sakkinen
2016-03-30 13:25 ` Jarkko Sakkinen
2016-03-31 5:46 ` Jason Gunthorpe
2016-03-31 6:37 ` Jarkko Sakkinen
2016-04-02 3:16 ` Jason Gunthorpe
2016-04-05 9:42 ` Jarkko Sakkinen
[not found] ` <CALD+uuwQnvKL7TsiBXme=P8NKEX2gD1mOx-AxV7OHiBgmi4ykw@mail.gmail.com>
2016-04-07 11:30 ` Jarkko Sakkinen [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-03-30 5:37 Jarkko Sakkinen
2016-03-30 6:22 ` kbuild test robot
2016-03-30 6:37 ` Jarkko Sakkinen
2016-03-30 6:50 ` kbuild test robot
2016-03-30 12:59 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160407113046.GA12554@intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=Jean-Luc.Blanc@st.com \
--cc=benoit.houyere@st.com \
--cc=christophe.ricard@gmail.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=tpmdd@selhorst.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).