Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4493389ybi; Mon, 15 Jul 2019 09:45:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWIUDtCPvG/7RVlmVuX+PTd6WryfbYZ3azkJe6SpA3pA7CXZIJwFZujJML27EK6OWwYbto X-Received: by 2002:a17:90a:2627:: with SMTP id l36mr31067297pje.71.1563209126470; Mon, 15 Jul 2019 09:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563209126; cv=none; d=google.com; s=arc-20160816; b=p1xcAfANwO7aOcpnhL9AsQuFXS1cb2HriDEPL/NsnY3wxSrm3P/aWOAuyVG/7xKrDx jBS3XH+C22CcsAgMxD4e/Dnayww6OOd2KqjdFImiGd1qkh+9VGrFKYFRC4OBwiiEjnoD MbfEhfd1+28HF7HBOUIUwFAdumiabVdYWsBzMQvkYKc1ZnIrOpfcN3/rdV07bWL3IlhX U/pHGnwJBGjogL8S0HHkmyxyQ+qCgsF3y8E6TJZ8Uv7IFXX6+A7DObohpiQn74s22BC2 NCoMGoleuKM3BBH7nx/nQavPjGHklL1FX8+HZmjWRspoGO5yNyzCxLFLO3drAuCRGOmX ODFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=lnlMmKrDbJLP6e2NaWJNdwGdGouLclFIY8IzTXn77oI=; b=vUDizF5odYurXayStk6QfLEiak8nTFtPVy7M+9Ldx/Y2v3d9Q+mXTMs9i+jd2KHFqB m6dp6sMCXGz/hQfZ3D//2k53zrRS76WbmeNxPcONl2VcU5bHaH3Jcvcachi0DTKqPgki QrKzSI3TJ5szhJyRH0nb6M515/S0vUbasoE1UTp+XD9G/X/85gw9sDC/5nT4wMF0t0Xh fk0VBKqC6MKBWvXHE5SAHTsD1Qc9jbtHAX87W5Bdt2NZDyJPcyGiclCxPR/vMs/2YLQa n1RaDrhdhESwewoax/ekkoD26Di9PuI38Hs1bElQ4zqnTxALSSimekSE9tBr/XEwWkgu df+A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si15880211plq.208.2019.07.15.09.45.10; Mon, 15 Jul 2019 09:45:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731463AbfGOQo3 (ORCPT + 99 others); Mon, 15 Jul 2019 12:44:29 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:33085 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730071AbfGOQo3 (ORCPT ); Mon, 15 Jul 2019 12:44:29 -0400 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id CBD685973DB97AE590A7; Mon, 15 Jul 2019 17:44:26 +0100 (IST) Received: from [10.220.96.108] (10.220.96.108) by smtpsuk.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 15 Jul 2019 17:44:19 +0100 Subject: Re: [PATCH] KEYS: trusted: allow module init if TPM is inactive or deactivated To: Jarkko Sakkinen CC: , , , , , , , , , , References: <20190705163735.11539-1-roberto.sassu@huawei.com> <20190711194811.rfsohbfc3a7carpa@linux.intel.com> From: Roberto Sassu Message-ID: Date: Mon, 15 Jul 2019 18:44:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190711194811.rfsohbfc3a7carpa@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.220.96.108] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/11/2019 9:48 PM, Jarkko Sakkinen wrote: > 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? According to the bug report at https://bugs.archlinux.org/task/62678, the trusted module is a dependency of the ecryptfs module. We should load the trusted module even if the TPM is inactive or deactivated. Given that commit 782779b60faa ("tpm: Actually fail on TPM errors during "get random"") changes the return code of tpm_get_random(), the patch should be modified to ignore the -EIO error. I will send a new version. Roberto -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Li Peng, Li Jian, Shi Yanli