Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6667156ioo; Thu, 2 Jun 2022 11:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHVl12DKMyul2zL/qMAnNLX+RR48NS+7MidY1/jV+Wy2aZmyoAPjeZlfAPoWYKJLjyoV4K X-Received: by 2002:a05:6402:ea1:b0:42b:2c59:503 with SMTP id h33-20020a0564020ea100b0042b2c590503mr6732264eda.9.1654193366458; Thu, 02 Jun 2022 11:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654193366; cv=none; d=google.com; s=arc-20160816; b=P+KKYLY8bTMnqt7lFxy0q79y+dO1+P/BzPRA7riGqsyhc9v5Z8a7PJjbCun2C8WjrU DMTzJ9aK/T+GODIqPg6QlO8PB6Gtln6r5UVK8YHO+IKLSjZJz1/pHeUoL7jMlXj2v37I TtvWjaA+GG7tu4+PhvGwDe4SxmJAwlQtuduZgLWu48LK7HsCIBn+nHPCNQBlafaiMKIH c3iBGEyRRkTkb8Y8wVdAKMjOTc2Wt9QtYByALPIf6ecZ8Axn1YhKKrDWhK+WV1gpJAPE 8731M4TQnN1nebZC6rqexWWdwNIQiQBqWB4g/mhbOetM92VQYAyyvTFtkyMsXvmP+RbG LLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6yHtbX1KH5gD1y1S/Nf7orNmW2TZ8AYrR1/Ir25QL3U=; b=z0udDF9aZb4JWPoLjAt3W1FrDURtvoXFAHGHDowNr63mdPHPV2kzmT6Yf78fu8OR7s QchcYfeihvGJXZrHGxLJOJqbUTDfSNuvjgoj2ch+zaw1r/afXSY08+0dY9p6I071n4Ns qdPsYIbqrSA+8oQPqlmWzJQVI2+I/JlygzDbIHSfiNmEsRX7Gbjws7k4iPYA4thzKc3K AUIY01YfNWae7TUeLYuXqxgfeM5Sd3Kc91qR34ZwOBzEMIxTqjFs6hLwtkCVqjLY0f3O LtxwGea1k1wpKsVM1Gd76q5PCRn9hrgWywLKcIaIwqN/4UYiGh8Bu/uQAsBIvCSW/vmS xqLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fec5AsNM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mc16-20020a170906eb5000b006ff453083c1si239784ejb.189.2022.06.02.11.08.59; Thu, 02 Jun 2022 11:09:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fec5AsNM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234205AbiFBL1a (ORCPT + 99 others); Thu, 2 Jun 2022 07:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234186AbiFBL1X (ORCPT ); Thu, 2 Jun 2022 07:27:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509102ACB46; Thu, 2 Jun 2022 04:27:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 395F8B81EFC; Thu, 2 Jun 2022 11:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 999A9C385A5; Thu, 2 Jun 2022 11:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654169238; bh=bkkX8lyw+LlhjrWMM9UPH00U1eomprbT2CFStMN6JTw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fec5AsNMHf1/CMW5blwRUqYNKLZZuq8z35ueIPBTc335mfgxSp/pO/sq8yCVBIl+x KRrwEzAO/oqKQJzJSceuE7U0nXAZTa6XhRR74WQkJFt5TQJ1NzA3uFStQ7zFY+L1VE DvjOUTVC1OoKmh8g7OJMhz4fTRiihbaI3QqEpoTkX/z7Khsq673LGR8LUvQ6T+NaS6 c9ZT7h0QliTPw7/PoMB2qvrrJ7KWsSk7ZqSxpslIry3PbAyZn/uzMjHxPJvmCmyaYc z4WmbM15tFbfKT6P8Wl7n4PchUaqTgJ0poc9Ho1Rc7t0EBlq7N9klGdYDboBpEmbyW SOsQmx1Gf9/7g== Date: Thu, 2 Jun 2022 14:25:26 +0300 From: Jarkko Sakkinen To: Stefan Mahnke-Hartmann Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, jgg@ziepe.ca Subject: Re: [PATCH] tpm: Add upgrade/reduced mode support for TPM1.2 modules Message-ID: References: <20220601083810.330809-1-stefan.mahnke-hartmann@infineon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220601083810.330809-1-stefan.mahnke-hartmann@infineon.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2022 at 10:38:11AM +0200, Stefan Mahnke-Hartmann wrote: > In case a TPM in failure mode is detected, the TPM should be accessible > through a transparent communication channel for analysing purposes (e.g. > TPM_GetTestResult) or a field upgrade. Since a TPM in failure mode has > similar reduced functionality as in field upgrade mode, the flag > TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE is also valid. > > As described in TCG TPM Main Part1 Design Principles, Revision 116, > chapter 9.2.1. the TPM also allows an update function in case a TPM is > in failure mode. > > If the TPM in failure mode is detected, the function tpm1_auto_startup() > sets TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE flag. This patch simply follows > the same rationale as TPM2 in field upgrade mode. "following the rationale" does not give a clue what it does. Also minor nit: write in imperative from, and please do not say "this patch". It won't be a patch, once it is in git. > Signed-off-by: Stefan Mahnke-Hartmann > --- > If you have any better suggestions, please let me know. > > drivers/char/tpm/tpm1-cmd.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c > index f7dc986fa4a0..7a42d74c450c 100644 > --- a/drivers/char/tpm/tpm1-cmd.c > +++ b/drivers/char/tpm/tpm1-cmd.c > @@ -710,8 +710,10 @@ int tpm1_auto_startup(struct tpm_chip *chip) > goto out; > rc = tpm1_do_selftest(chip); > if (rc) { > - dev_err(&chip->dev, "TPM self test failed\n"); > - goto out; > + dev_err(&chip->dev, "TPM self test failed, so the TPM has limited functionality\n"); > + /* A TPM in this state possibly allows or needs a firmware upgrade */ > + chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE; > + rc = 0; > } > > return rc; > -- > 2.25.1 > Why all error codes trigger this action, e.g. all possible TPM2 errors and -ETIME? BR, Jarkko