Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4650516imu; Tue, 29 Jan 2019 05:20:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN5dRX8F7NdJr/r6ovCkK5Vjo0TGznfzFg/nGmOvOrgSW+LHMVB1m5LKs/Xm0ncM7k38/o0V X-Received: by 2002:a17:902:4124:: with SMTP id e33mr25954284pld.236.1548768041305; Tue, 29 Jan 2019 05:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548768041; cv=none; d=google.com; s=arc-20160816; b=O+B6tWNZDmEGFwNQ0bhMD+AQZPdD9GSSfaaC8/2QsNubaInMv1eXtfumJSdnqpbDx2 hFifdipq1FkqEDD0Ycq4yB0a+dyVLQJEbu49Eq/WMnvF47j6Dao0NJ7LQ122o8kGkEDg B0yGHG1lL0XyoNZWSr8CphMCRKgnK7hujbtMq72Vf8drxWQ2QNMpEgLKBD6eNWqmX6/r C75QSFeCZbc8X5NbXc5GjkEtNbD0vPV0RWSMou02VYRtqE5tYG+t/wpxh6Im3r/ezgcT PH/Zy7zkPztBaYKPX05vjeR7VQ/rwn32txaJPf5ksgXAxHM8ZmQ5F6e7axk9lx8U267N 12Rw== 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=e/7EpGIvXj/8FkfBvzrL6m5f65aZfTpSuQ19fncWXko=; b=v9gityJspJnJWNd48GHgJpkcOeESUXkm2Q7edH+UrLW8K6THsMZ1W1gNShRQ8kPZJg VYbfqxDkmzUnUr1oOu6hJ6FyJ7f9VWcT9U9vX96CrIMLXVnR9gu6K6hFt4q7hXys4Zrm RvO1lXhHosZJIS0RNnTvDYZ3GwWt/hbIzvhLHHBcT/zjfAUiUVQr3FPB9K92drt3hZMQ 163PrKrMLrU7+eKOogU6ig6Bkz84PtO7SQrej9ZSJ1Rcx/BxI+nyyO+dWzCMeLBgIore FnUbBAfxR7nWJg+hg9ojiqxNXp/m0TFVoD59UUNtVjSdcwmOECCm3O5N5ns6NtmzNoD7 yvPg== 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 t4si33513302pgg.110.2019.01.29.05.20.25; Tue, 29 Jan 2019 05:20:41 -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 S1726383AbfA2NUU (ORCPT + 99 others); Tue, 29 Jan 2019 08:20:20 -0500 Received: from mga06.intel.com ([134.134.136.31]:59450 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbfA2NUU (ORCPT ); Tue, 29 Jan 2019 08:20:20 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 05:20:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,537,1539673200"; d="scan'208";a="138829651" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.127]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2019 05:20:17 -0800 Date: Tue, 29 Jan 2019 15:20:16 +0200 From: Jarkko Sakkinen To: Linus Torvalds 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: <20190129132016.GA1602@linux.intel.com> References: <20190118142559.GA4080@linux.intel.com> <1547849358.2794.90.camel@HansenPartnership.com> <20190120160413.GB30478@linux.intel.com> <20190122010218.GA26713@linux.intel.com> <20190122025836.GH25163@ziepe.ca> <20190122132910.GA2720@linux.intel.com> <20190123153638.GA8727@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Thu, Jan 24, 2019 at 07:43:30AM +1300, Linus Torvalds wrote: > On Thu, Jan 24, 2019 at 4:36 AM Jarkko Sakkinen > wrote: > > > > > > Is it just that this particular hardware always happened to trigger > > > the ERMS case (ie "rep movsb")? > > > > This is the particular snippet in question: > > > > memcpy_fromio(buf, priv->rsp, 6); > > expected = be32_to_cpup((__be32 *) &buf[2]); > > if (expected > count || expected < 6) > > return -EIO; > > Ok, strange. > > So what *used* to happen is that the memcpy_fromio() would just expand > as a "memcpy()", and in this case, gcc would then inline the memcpy(). > In fact, gcc does it as a 4-byte access and a two-byte access from > what I can tell. I verified, and it is exactly as you stated: 0xffffffff814aaa33 <+51>: mov (%rax),%edx 0xffffffff814aaa35 <+53>: mov %edx,0x0(%rbp) 0xffffffff814aaa38 <+56>: movzwl 0x4(%rax),%eax 0xffffffff814aaa3c <+60>: mov %ax,0x4(%rbp) And your new version does exactly the same thing to the first six bytes (with different opcode, but the same memory access pattern). /Jarkko