linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>, tomas.winkler@intel.com
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: Getting weird TPM error after rebasing my tree to security/next-general
Date: Thu, 31 Jan 2019 20:35:31 +0200	[thread overview]
Message-ID: <20190131183530.GA27112@linux.intel.com> (raw)
In-Reply-To: <20190131170603.GA18349@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Thu, Jan 31, 2019 at 07:06:03PM +0200, Jarkko Sakkinen wrote:
> Found something that *does* fix the issue. If I replace memcpy_*io()
> calls with regular memcpy(), the driver works and all my tests pass.

OK, so the length of the response is not trashed, but only the error
code. The attached patch fully fixes the issue.

Here's the header again:

struct tpm_output_header {
	__be16	tag;
	__be32	length;
	__be32	return_code;
} __packed;

The first to fields *are* read correctly and the last field get 1's
(thus TPM error -1).

With the attached the patch things work properly, but still
unsatisfactory fix (return to old behavior because it seems to
work).

/Jarkko

[-- Attachment #2: 0001-tpm-tpm_crb-Revert-to-memcpy-for-copying-tail-of-the.patch --]
[-- Type: text/x-diff, Size: 901 bytes --]

From 8ff7eb66e1dc05daf1319bf8365e5a3434a90061 Mon Sep 17 00:00:00 2001
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date: Thu, 31 Jan 2019 20:16:00 +0200
Subject: [PATCH] tpm/tpm_crb: Revert to memcpy() for copying tail of the
 response

Revert the behavior before 170d13ca3a2f.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_crb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 36952ef98f90..003923ea50d2 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -299,7 +299,7 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
 	if (expected > count || expected < 6)
 		return -EIO;
 
-	memcpy_fromio(&buf[6], &priv->rsp[6], expected - 6);
+	memcpy(&buf[6], &priv->rsp[6], expected - 6);
 
 	return expected;
 }
-- 
2.19.1


  parent reply	other threads:[~2019-01-31 18:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 14:25 Getting weird TPM error after rebasing my tree to security/next-general Jarkko Sakkinen
2019-01-18 22:09 ` James Bottomley
2019-01-20 16:04   ` Jarkko Sakkinen
2019-01-22  1:02     ` Jarkko Sakkinen
2019-01-22  2:58       ` Jason Gunthorpe
2019-01-22 13:29         ` Jarkko Sakkinen
2019-01-22 18:26           ` Linus Torvalds
2019-01-23 15:36             ` Jarkko Sakkinen
2019-01-23 18:43               ` Linus Torvalds
2019-01-29 13:20                 ` Jarkko Sakkinen
2019-01-31 12:26                   ` Jarkko Sakkinen
2019-01-31 16:04                     ` Jarkko Sakkinen
2019-01-31 17:06                       ` Jarkko Sakkinen
2019-01-31 17:43                         ` Linus Torvalds
2019-01-31 18:47                           ` Jarkko Sakkinen
2019-01-31 18:35                         ` Jarkko Sakkinen [this message]
2019-01-31 18:51                           ` Linus Torvalds
2019-01-31 18:52                             ` Linus Torvalds
2019-01-31 19:10                               ` Linus Torvalds
2019-01-31 19:47                                 ` Winkler, Tomas
2019-02-01  8:12                                   ` Jarkko Sakkinen
2019-01-31 20:07                                 ` Winkler, Tomas
2019-01-31 20:47                                 ` Jarkko Sakkinen
2019-01-31 21:58                                   ` Linus Torvalds
2019-01-31 23:31                                     ` Jerry Snitselaar
2019-02-01 11:40                                       ` Jarkko Sakkinen
2019-01-31 20:45                             ` Jarkko Sakkinen
2019-02-01 18:04                               ` Linus Torvalds
2019-02-04 11:58                                 ` Jarkko Sakkinen
2019-01-23 20:11               ` Jarkko Sakkinen

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=20190131183530.GA27112@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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).