Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7469709imu; Thu, 31 Jan 2019 10:36:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5z8HKunSU2dq+Tw7UN9tpngbqDUD3K00Jm73ggCTR2PuI04Nf9PKZ5X+eF5gAnHWfot1n6 X-Received: by 2002:a63:bd51:: with SMTP id d17mr32934096pgp.443.1548959760114; Thu, 31 Jan 2019 10:36:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548959760; cv=none; d=google.com; s=arc-20160816; b=qjwv8yNjnAPuaaaMUNB5IhPMc/i8X5mO3mpgZ8+LXAdsEg190je6ofNbBbvssJlpRJ BSnYKrwmRO+XhQ+UYqzLxmaRCVM7IEdX7snPDYno3FGUn5WGPxYRrEypXRbfMMJfEsTL Qr00ibGpwgH3hPjYArFrGd9bYUr8S6Ftf5qiLfm1tTdX8oUPrMpfmimbBiX4dhYdFz53 DMnY38pCAWRT1hHa9EkfSQbE3BqiraRauSazPBcXDcAY+A/27Wu/FnQuII9CORdB+c97 OIDnDUC1i3B5SwEK5ffEOo7aOSIYIP88bTcnO3p+HZnEupGRHNOFC+R69TJHtG1LwuZ6 qQdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8HghIieZK0GSx/2YIufUK5qSrlNouDU43hDw9RbVUjY=; b=B3nRkkRssjY3x/9S8FpxQgXeydoHHrbdkPe+r5lqwBfuoJ4GUVrVUt+cPylW4QslAT TWx4o7fVp+OVpKPa2dHJMP1Xcgsow5adwrBMn/biYRArZFdDKI9IySGwz57ZOr88+eqO H6+L3r/AMcMigKWV0KPGKLPI6SbuZjky/Mz/IOW42dOcSJcfmYQB9v7qzVPIRgIrJS7a I05yjsEiPCmMMMz42HYMJrUYl/k7f8hbs/fnYm1n+luU4DUQfDUHpRGWkbZVAP9rxOZA IoLEv3qVloLlW7a5NuiRJvONOQz5UnHLjKDB9Xp+wHXfBYTqeNx+N7/dNhsv+HhUVjnf I4yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q18si5517232pls.30.2019.01.31.10.35.43; Thu, 31 Jan 2019 10:36:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbfAaSfg (ORCPT + 99 others); Thu, 31 Jan 2019 13:35:36 -0500 Received: from mga18.intel.com ([134.134.136.126]:60281 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfAaSfg (ORCPT ); Thu, 31 Jan 2019 13:35:36 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2019 10:35:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,545,1539673200"; d="scan'208,223";a="112698730" Received: from rkazants-mobl.ccr.corp.intel.com (HELO localhost) ([10.249.254.212]) by orsmga006.jf.intel.com with ESMTP; 31 Jan 2019 10:35:31 -0800 Date: Thu, 31 Jan 2019 20:35:31 +0200 From: Jarkko Sakkinen To: Linus Torvalds , tomas.winkler@intel.com Cc: Jason Gunthorpe , James Bottomley , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Linux List Kernel Mailing Subject: Re: Getting weird TPM error after rebasing my tree to security/next-general Message-ID: <20190131183530.GA27112@linux.intel.com> References: <20190122010218.GA26713@linux.intel.com> <20190122025836.GH25163@ziepe.ca> <20190122132910.GA2720@linux.intel.com> <20190123153638.GA8727@linux.intel.com> <20190129132016.GA1602@linux.intel.com> <20190131122606.GA12470@linux.intel.com> <20190131160437.GA5629@linux.intel.com> <20190131170603.GA18349@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: <20190131170603.GA18349@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --YiEDa0DAkWCtVeE4 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-tpm-tpm_crb-Revert-to-memcpy-for-copying-tail-of-the.patch" From 8ff7eb66e1dc05daf1319bf8365e5a3434a90061 Mon Sep 17 00:00:00 2001 From: Jarkko Sakkinen 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 --- 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 --YiEDa0DAkWCtVeE4--