Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10888201ybi; Thu, 11 Jul 2019 12:49:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxK2Im4ZBuZylPGRcxLKNzq23t9wIw2GjklXsXe58g5izhN/dpdT8DdCFVgyQdn6h98UK9T X-Received: by 2002:a63:bf01:: with SMTP id v1mr6116416pgf.278.1562874542559; Thu, 11 Jul 2019 12:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562874542; cv=none; d=google.com; s=arc-20160816; b=A4P1/jDOpcUBaoxOyTeOBXqzUybXNBsCnKSRBAIrWcHBpwZsj0Fgykb3hacKySrSVc 67z2sRi1jsvJg9D1f4b3z4x4CdnrALpFZShiBJdkD2LrMNe+RRP8yhZ33S2Zz0GhYDLk G46E2GPmchneXhgp6dKGoTNrtniJ0xtkP4jGnX4CtGTIpwvFyS6zjFXNZyc4BKIgxyZV KyJjhvQ9QhaGW5bjl/nnKppsyN7dbL4TTY49djvqhRmb6XulXtBDm7TZRryLnDrggw/2 jDs1CrpGBNrupImEPVZnYVOUDmUnPmXTUSR33dV1F0YhrrcMbT8lkfWmZXWh9qPR0f8O WCCg== 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=vKX0XjAAS7LlkrXhCIaH7J6tK1xzEyXmioglZll7Zmc=; b=EaFF5rIhyzFfa364Q8wyeAGgWBjyTHbxv0cBgMmEbTJjYPpFC9n8PoQjcdofpBqpnB 1KF0HXoGyB243BSd5j8V2FXD0jcmx3B1uxyToUD0aWmOm7Nua9Y9QQ3woKl3SxvTbzjA NJRTVCuwumQydrU0xwMgOplJ2hXDPKzXPchR8OMpsaBSQ8INU14STMdCRsRi6ORMEE9M knM7YCX7uZf7NSa45va3AxJK7gIGJKXtgtzXzUVSEKoEh4zK0hZB6S0V/XcegSFJMVeR gmFmzu5KBjM8z+0asBhjm3iHcqAi4C2qAqcQrBUgKKOJIZTLmEDctGo75zPqitjqpDuq M6vA== 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 f15si6021496pgi.56.2019.07.11.12.48.46; Thu, 11 Jul 2019 12:49:02 -0700 (PDT) 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 S1728934AbfGKTsU (ORCPT + 99 others); Thu, 11 Jul 2019 15:48:20 -0400 Received: from mga02.intel.com ([134.134.136.20]:42927 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728679AbfGKTsU (ORCPT ); Thu, 11 Jul 2019 15:48:20 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2019 12:48:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,479,1557212400"; d="scan'208";a="168116079" Received: from mmoerth-mobl6.ger.corp.intel.com (HELO localhost) ([10.249.35.82]) by fmsmga007.fm.intel.com with ESMTP; 11 Jul 2019 12:48:14 -0700 Date: Thu, 11 Jul 2019 22:48:11 +0300 From: Jarkko Sakkinen To: Roberto Sassu Cc: jejb@linux.ibm.com, zohar@linux.ibm.com, jgg@ziepe.ca, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, crazyt2019+lml@gmail.com, tyhicks@canonical.com, nayna@linux.vnet.ibm.com, silviu.vlasceanu@huawei.com Subject: Re: [PATCH] KEYS: trusted: allow module init if TPM is inactive or deactivated Message-ID: <20190711194811.rfsohbfc3a7carpa@linux.intel.com> References: <20190705163735.11539-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190705163735.11539-1-roberto.sassu@huawei.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 05, 2019 at 06:37:35PM +0200, Roberto Sassu wrote: > Commit c78719203fc6 ("KEYS: trusted: allow trusted.ko to initialize w/o a > TPM") allows the trusted module to be loaded even a TPM is not found to > avoid module dependency problems. > > Unfortunately, this does not completely solve the issue, as there could be > a case where a TPM is found but is not functional (the TPM commands return > an error). Specifically, after the tpm_chip structure is returned by > tpm_default_chip() in init_trusted(), the execution terminates after > init_digests() returns -EFAULT (due to the fact that tpm_get_random() > returns a positive value, but less than TPM_MAX_DIGEST_SIZE). > > This patch fixes the issue by ignoring the TPM_ERR_DEACTIVATED and > TPM_ERR_DISABLED errors. Why allow trusted module to initialize if TPM is not functional? Also: err = tpm_transmit_cmd(chip, &buf, offsetof(struct tpm2_get_random_out, buffer), "attempting get random"); if (err) { if (err > 0) err = -EIO; goto out; } /Jarkko