From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56068C433FF for ; Mon, 5 Aug 2019 21:05:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33BB0216F4 for ; Mon, 5 Aug 2019 21:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730633AbfHEVFG (ORCPT ); Mon, 5 Aug 2019 17:05:06 -0400 Received: from mga04.intel.com ([192.55.52.120]:6081 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730454AbfHEVFG (ORCPT ); Mon, 5 Aug 2019 17:05:06 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 14:05:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,350,1559545200"; d="scan'208";a="181784680" Received: from unknown (HELO localhost) ([10.252.52.83]) by FMSMGA003.fm.intel.com with ESMTP; 05 Aug 2019 14:05:02 -0700 Date: Tue, 6 Aug 2019 00:05:01 +0300 From: Jarkko Sakkinen To: Greg KH Cc: Doug Anderson , Jason Gunthorpe , "# 4.0+" , Guenter Roeck , Vadim Sukhomlinov , Arnd Bergmann , Peter Huewe , LKML , linux-integrity@vger.kernel.org Subject: Re: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Message-ID: <20190805210501.vjtmwgxjg334vtnc@linux.intel.com> References: <20190711162919.23813-1-dianders@chromium.org> <20190711163915.GD25807@ziepe.ca> <20190711170437.GA7544@kroah.com> <20190711171726.GE25807@ziepe.ca> <20190711172630.GA11371@kroah.com> <20190712115025.GA8221@kroah.com> <20190712152734.GA13940@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712152734.GA13940@kroah.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20180716 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Fri, Jul 12, 2019 at 05:27:34PM +0200, Greg KH wrote: > On Fri, Jul 12, 2019 at 08:00:12AM -0700, Doug Anderson wrote: > > Hi, > > > > On Fri, Jul 12, 2019 at 4:50 AM Greg KH wrote: > > > > > > On Thu, Jul 11, 2019 at 10:28:01AM -0700, Doug Anderson wrote: > > > > Hi, > > > > > > > > On Thu, Jul 11, 2019 at 10:26 AM Greg KH wrote: > > > > > > > > > > On Thu, Jul 11, 2019 at 02:17:26PM -0300, Jason Gunthorpe wrote: > > > > > > On Thu, Jul 11, 2019 at 07:04:37PM +0200, Greg KH wrote: > > > > > > > On Thu, Jul 11, 2019 at 01:39:15PM -0300, Jason Gunthorpe wrote: > > > > > > > > On Thu, Jul 11, 2019 at 09:29:19AM -0700, Douglas Anderson wrote: > > > > > > > > > From: Vadim Sukhomlinov > > > > > > > > > > > > > > > > > > commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 upstream. > > > > > > > > > > > > > > > > > > TPM 2.0 Shutdown involve sending TPM2_Shutdown to TPM chip and disabling > > > > > > > > > future TPM operations. TPM 1.2 behavior was different, future TPM > > > > > > > > > operations weren't disabled, causing rare issues. This patch ensures > > > > > > > > > that future TPM operations are disabled. > > > > > > > > > > > > > > > > > > Fixes: d1bd4a792d39 ("tpm: Issue a TPM2_Shutdown for TPM2 devices.") > > > > > > > > > Cc: stable@vger.kernel.org > > > > > > > > > Signed-off-by: Vadim Sukhomlinov > > > > > > > > > [dianders: resolved merge conflicts with mainline] > > > > > > > > > Signed-off-by: Douglas Anderson > > > > > > > > > Reviewed-by: Jarkko Sakkinen > > > > > > > > > Signed-off-by: Jarkko Sakkinen > > > > > > > > > This is the backport of the patch referenced above to 4.19 as was done > > > > > > > > > in Chrome OS. See for details. It > > > > > > > > > presumably applies to some older kernels. NOTE that the problem > > > > > > > > > itself has existed for a long time, but continuing to backport this > > > > > > > > > exact solution to super old kernels is out of scope for me. For those > > > > > > > > > truly interested feel free to reference the past discussion [1]. > > > > > > > > > > > > > > > > > > Reason for backport: mainline has commit a3fbfae82b4c ("tpm: take TPM > > > > > > > > > chip power gating out of tpm_transmit()") and commit 719b7d81f204 > > > > > > > > > ("tpm: introduce tpm_chip_start() and tpm_chip_stop()") and it didn't > > > > > > > > > seem like a good idea to backport 17 patches to avoid the conflict. > > > > > > > > > > > > > > > > Careful with this, you can't backport this to any kernels that don't > > > > > > > > have the sysfs ops locking changes or they will crash in sysfs code. > > > > > > > > > > > > > > And what commit added that? > > > > > > > > > > > > commit 2677ca98ae377517930c183248221f69f771c921 > > > > > > Author: Jarkko Sakkinen > > > > > > Date: Sun Nov 4 11:38:27 2018 +0200 > > > > > > > > > > > > tpm: use tpm_try_get_ops() in tpm-sysfs.c. > > > > > > > > > > > > Use tpm_try_get_ops() in tpm-sysfs.c so that we can consider moving > > > > > > other decorations (locking, localities, power management for example) > > > > > > inside it. This direction can be of course taken only after other call > > > > > > sites for tpm_transmit() have been treated in the same way. > > > > > > > > > > > > The last sentence suggests there are other patches needed too though.. > > > > > > > > > > So 5.1. So does this original patch need to go into the 5.2 and 5.1 > > > > > kernels? > > > > > > > > The patch ("Fix TPM 1.2 Shutdown sequence to prevent future TPM > > > > operations")? It's already done. It just got merge conflicts when > > > > going back to 4.19 which is why I sent the backport. > > > > > > But the sysfs comment means I should not apply this backport then? > > > > > > Totally confused by this long thread, sorry. > > > > > > What am I supposed to do for the stable trees here? > > > > I think the answer is to drop my backport for now and Jarkko says > > he'll take a fresh look at it in 2 weeks when he's back from his > > leave. Thus my understanding: > > > > * On mainline: fixed > > > > * On 5.2 / 5.1: you've already got this picked to stable. Good > > > > * On 4.14 / 4.19: Jarkko will look at in 2 weeks. > > > > * On 4.9 and older: I'd propose skipping unless someone is known to > > need a solution here. > > Thanks, that makes sense now. > > greg k-h I have not forgotten this but might have to postpone the backport after Linux Plumbers. Just have lots of stuff in my queue ATM but right after the conference I have good slot to do the backports. /Jarkko