Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp193335ybp; Thu, 3 Oct 2019 12:07:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYOy0jRTRItqdPy9m9jd2YLA9pfT5+kQV5FLy40PwUk7rnmb2V+dISe7T42nG9DCbV5v1V X-Received: by 2002:a05:6402:1583:: with SMTP id c3mr11343608edv.286.1570129677153; Thu, 03 Oct 2019 12:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570129677; cv=none; d=google.com; s=arc-20160816; b=clBR6Y4iA+/EFb7z7IbVmaVBtQhfmQJY9JXHATYaEtsTsm9Pr1D5DHFMv8lJlpBKaF dhHs3VcBwcq+p9RwWC2kkGQe9dHbn7eLCSNPmFXhFVFn4oBUsabLTp3guMdhzR11Y/CP tMuc9/VtQkCMo+2T+IYIvy9vmERCWrJlpNuUr3sfWkFE9lsKFTqflg5lpWu61vR7T/+N /xeDGikEql3z1K4RA66FBbQCEvkenhkhr9ikJ588PRLPk+wuG6lxFeTQcwKt1p80moBI JRySmqTQrHoRSy2RBdz7jmSgwwgJfB9R+OqrrfyWp+GB6epEmPTudhkpapyambqyMFv8 gvSg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rwn/ib183Y/XDvvqwXt2vTlSTugsNTDOFOk9tkAzl5U=; b=T44SOiqTV7vEkuh2qHS039TP1hXmAOa1YilzUbB2NdPjeg+jqfVti7wjHzqkRMEs2d R9mxDfnJGtht1cC+jQBXt8/Hv60fGYP3SXRkhnJjQHqNJbywi0Afnn8aY0+DZs4LsXWa NGMVUP6Eae5fcVh/91uaP4kt8xBI/vBlqK5RtMqZxWM+9/4n7giOINj9s0pBjxZUrVsV wkXQ2wnHf3t/m6mBRMihLv7d1G0HFXKGDioK/80UPQNaJT0KkHU7Pp7PUM3PyXTb81bh t7dNOMrWbSvvFMc6KeKWXYDyG/+r6GSos0xtGqb/nA6qLiWnYD9EVeFTHIickXTVut9+ GptA== 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 s24si1710279ejb.16.2019.10.03.12.07.32; Thu, 03 Oct 2019 12:07:57 -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 S2389159AbfJCSbH (ORCPT + 99 others); Thu, 3 Oct 2019 14:31:07 -0400 Received: from mga05.intel.com ([192.55.52.43]:45441 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729064AbfJCSbH (ORCPT ); Thu, 3 Oct 2019 14:31:07 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2019 11:31:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,253,1566889200"; d="scan'208";a="216909589" Received: from jvalevi1-mobl1.ger.corp.intel.com (HELO localhost) ([10.251.93.117]) by fmsmga004.fm.intel.com with ESMTP; 03 Oct 2019 11:31:02 -0700 Date: Thu, 3 Oct 2019 21:31:01 +0300 From: Jarkko Sakkinen To: Mimi Zohar Cc: linux-integrity@vger.kernel.org, Jerry Snitselaar , James Bottomley , Sumit Garg , Stefan Berger , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list Subject: Re: [PATCH] tpm: Detach page allocation from tpm_buf Message-ID: <20191003182934.GB20683@linux.intel.com> References: <20190925134842.19305-1-jarkko.sakkinen@linux.intel.com> <20190926124635.GA6040@linux.intel.com> <20190926131227.GA6582@linux.intel.com> <1570020024.4999.104.camel@linux.ibm.com> <20191003113211.GC8933@linux.intel.com> <1570106350.4421.166.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1570106350.4421.166.camel@linux.ibm.com> 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, Oct 03, 2019 at 08:39:10AM -0400, Mimi Zohar wrote: > On Thu, 2019-10-03 at 14:32 +0300, Jarkko Sakkinen wrote: > > On Wed, Oct 02, 2019 at 08:40:24AM -0400, Mimi Zohar wrote: > > > On Thu, 2019-09-26 at 16:12 +0300, Jarkko Sakkinen wrote: > > > > On Thu, Sep 26, 2019 at 03:46:35PM +0300, Jarkko Sakkinen wrote: > > > > > On Wed, Sep 25, 2019 at 04:48:41PM +0300, Jarkko Sakkinen wrote: > > > > > > - tpm_buf_reset(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_RANDOM); > > > > > > + tpm_buf_reset(&buf, data_ptr, PAGE_SIZE, > > > > > > + TPM2_ST_NO_SESSIONS, TPM2_CC_PCR_EXTEND); > > > > > > > > > > Oops. > > > > > > > > Maybe we could use random as the probe for TPM version since we anyway > > > > send a TPM command as a probe for TPM version: > > > > > > > > 1. Try TPM2 get random. > > > > 2. If fail, try TPM1 get random. > > > > 3. Output random number to klog. > > > > > > > > Something like 8 bytes would be sufficient. This would make sure that > > > > no new change breaks tpm_get_random() and also this would give some > > > > feedback that TPM is at least somewhat working. > > > > > > That involves sending 2 TPM commands. ?At what point does this occur? > > > ?On registration? ?Whenever getting a random number? ?Is the result > > > cached in chip->flags? > > > > On registeration. It is just printed to klog. > > What sets "TPM_CHIP_FLAG_TPM2" in chip->flags? ?And when? > > > > > > Will this delay the TPM initialization, causing IMA to go into "TPM > > > bypass mode"? > > > > Of course it will delay the init. > > Delaying the init will most likely cause regressions on systems with > TPM 1.2 systems. > > Instead of sending the TPM 2.0 command and on failure sending the TPM > 1.2 version of the command, could chip->flags be tested? ?And if not > chip->flags, then provide the TPM version as part of registration. No rush pushing this forward. I got your point. > > As I've stated before the real fix for the bypass issue would be > > to make TPM as part of the core but this has not received much > > appeal. I think I've sent patch for this once. > > I must have missed this discussion. Yeah, I think that'd be a great idea. We need a better control on TPM core as multiple subsystem's depend on it in API level. Something to reconsider in future. /Jarkko