Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp213392rdb; Mon, 22 Jan 2024 18:10:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyzTuLvafoY4CkKA6GcIBUd0Mx3Lt2Wy/1iNqQryf9NzE6/q27guYUUCGH4LvQ9DQ7itzS X-Received: by 2002:a05:6a20:9152:b0:19a:5ec1:7078 with SMTP id x18-20020a056a20915200b0019a5ec17078mr2690096pzc.69.1705975822103; Mon, 22 Jan 2024 18:10:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705975822; cv=pass; d=google.com; s=arc-20160816; b=URoaV6ecNP5qK4mOI9Hlx9JR7/si5nkZ+Y2ne1EWUAh9s8+7X8kMbJ5mzaSW+VRceS v8QXOv9Gp6jHHuV60iADgK0Moq9WKiHvKnrDwJlJ4AVaGvBzr8rvjy2m57ALN9h0K8D1 4PraXBeQ6kB+A8XQq41ExCInUVOLxzYWAcURPcwO6rKIkLj3n8qu1+yl133CPY2zgvmn 0DJxq5Wny9wGmSNjv++CXt2mcCsoFBhT5Bg6UTwWGw9RSMgM8klr3xjuC7Mb4dLWMe6E 25zAG2UdVHVhapFO3cN9dKlGDpWjni+eFTpnqojHWb8J+ATF4Lv9nc/vKcpAY3tAiFdV l49A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=95YLcSLh10wujNMjsdNLKzRqGYmh+xeEqrG0Yu4QHL8=; fh=SagF4C8OaytTzHJT3EomxGcaq0UKubfM4Uky2NHeUwc=; b=0wUJHnjbvMbAP/hpdivMORmOeNpX8EtvZiq3R1rGLpH+RvxfVz0O7uSobNPqJMIQJo WIFprqfLoipXs3M1p47XNo6174K2ihRo/necYNYCngX15eLE9K8bPrEseq90MsB1gmvt O1L3/x3F50LJpQXSAQ056eiXhw4NVhfZr/z/NOytAt+nlrd0C9eYTK5zJdUVGfeZu9au XkBeB/MNsjO6SBgK4WETo7ZbbtEtGnrEqzk2SO/NeJt2pPefQJiElJdawzYizuMARln3 3Embu1SCHSrE9tM+qh2AbTaycp9kBIEmXfxTUgve4rMgNDZ/f63RQxmQVnMABXuC2hag bLvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fuybMpwo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34228-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34228-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q18-20020a17090ad39200b0028ff844e08fsi8952117pju.28.2024.01.22.18.10.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 18:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34228-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fuybMpwo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34228-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34228-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D6453285F39 for ; Mon, 22 Jan 2024 22:12:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97D234878F; Mon, 22 Jan 2024 22:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fuybMpwo" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56270482E2 for ; Mon, 22 Jan 2024 22:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705961531; cv=none; b=eGaAjisRBrt/OJa1oyYfvVPf1S4TeOSJTdt2lK76VF2sOKMA4utmrDgNoNXhdQJ7mRJnbCaJFT11PUJLCYsHYL6aqu4AVQv1SCetmtidzUU6Fvskl3OqSOlNHtx1xykPSctmrxfnW0mXtFnT+WVRS0xfBTR2GnRDgFU06pZM4A0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705961531; c=relaxed/simple; bh=eWQXk0sfcnAQS723Yb4pigupSKjfFt31ay1qJ/1xMKE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=W8eo7EjHZIvCPqkEuEZcBYisir1LK5ozPWmbvDRAbTgigHwgxiEU4gAoizpBGMgSK5+sMzzWC9nVgFHcEnJnCJR08cF9GXOcNXNOHbsq2yHPHGaMCADN33MpgTVJqKNkdaZCasUh228ySg2PF4TEyjOOwFdIX1YXUIpKu7CAK7M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fuybMpwo; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705961530; x=1737497530; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=eWQXk0sfcnAQS723Yb4pigupSKjfFt31ay1qJ/1xMKE=; b=fuybMpwoDcgYsYu1BfNuufI2Nh5Pg+8uB2SlvM1G6WjoLMgEH9c7E7Jq 74ob4FTe5wHTanoMAxmET9uIHyhl8bxUfDZubLsiQfR6sycIXSYicLUFy ycx9nPXdxphoOcaSsYuF2L/ThWyMEaiSxaA9nEXj8WxK3LsvS/1lXVZSk qceO/qfu1Wki8GaKZlSEj1DVGe2g1bb7sRHNF+EORafyl27KGDhVQW1xC OaGOZDlCjor4laUARDbZRI/ylNY0UVlgJKm/CHx1lrcuoEfGmucEqv4Xf 2hX2Z2dOHhy3wf0imZDyqkfHYxG4oC2VYIWwtNtY4xO5yvDa/JQAmueZt w==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="1194488" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="1194488" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 14:12:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="929121025" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="929121025" Received: from sjbowden-mobl1.amr.corp.intel.com (HELO [10.209.73.34]) ([10.209.73.34]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 14:12:09 -0800 Message-ID: <2bd7c80b-9cd8-4450-a410-c3739d224167@linux.intel.com> Date: Mon, 22 Jan 2024 14:12:08 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 3/4] tsm: Allow for mapping RTMRs to TCG TPM PCRs Content-Language: en-US To: Samuel Ortiz Cc: Dan Williams , linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240114223532.290550-1-sameo@rivosinc.com> <20240114223532.290550-4-sameo@rivosinc.com> <1bbf8d3e-aa94-48c7-a1e4-76f9eefc4af7@linux.intel.com> <65a72c305291f_3b8e29484@dwillia2-xfh.jf.intel.com.notmuch> <5539c533-37b2-4b12-a5c5-056881cf8e3c@linux.intel.com> From: Kuppuswamy Sathyanarayanan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/21/24 8:31 AM, Samuel Ortiz wrote: > On Tue, Jan 16, 2024 at 07:35:30PM -0800, Kuppuswamy Sathyanarayanan wrote: >> On 1/16/24 5:24 PM, Dan Williams wrote: >>> Kuppuswamy Sathyanarayanan wrote: >>>> On 1/14/24 2:35 PM, Samuel Ortiz wrote: >>>>> Many user space and internal kernel subsystems (e.g. the Linux IMA) >>>>> expect a Root of Trust for Storage (RTS) that allows for extending >>>>> and reading measurement registers that are compatible with the TCG TPM >>>>> PCRs layout, e.g. a TPM. In order to allow those components to >>>>> alternatively use a platform TSM as their RTS, a TVM could map the >>>>> available RTMRs to one or more TCG TPM PCRs. Once configured, those PCR >>>>> to RTMR mappings give the kernel TSM layer all the necessary information >>>>> to be a RTS for e.g. the Linux IMA or any other components that expects >>>>> a TCG compliant TPM PCRs layout. >>>>> >>>>> TPM PCR mappings are configured through configfs: >>>>> >>>>> // Create and configure 2 RTMRs >>>>> mkdir /sys/kernel/config/tsm/rtmrs/rtmr0 >>>>> mkdir /sys/kernel/config/tsm/rtmrs/rtmr1 >>>>> echo 0 > /sys/kernel/config/tsm/rtmrs/rtmr0/index >>>>> echo 1 > /sys/kernel/config/tsm/rtmrs/rtmr1/index >>>>> >>>>> // Map RTMR 0 to PCRs 4, 5, 6, 7 and 8 >>>>> echo 4-8 > /sys/kernel/config/tsm/rtmrs/rtmr0/tcg_map >>>>> >>>>> // Map RTMR 1 to PCRs 16, 17 and 18 >>>>> echo 16-18 > /sys/kernel/config/tsm/rtmrs/rtmr1/tcg_map >>>> Any information on how this mapping will be used by TPM or IMA ? >>>> >>>> RTMR to PCR mapping is fixed by design, right? If yes, why allow >>>> user to configure it. We can let vendor drivers to configure it, right? >>> I assume the "vendor driver", that publishes the RTMR to the tsm-core, >>> has no idea whether they will be used for PCR emulation, or not. The TPM >>> proxy layer sitting on top of this would know the mapping of which RTMRs >>> are recording a transcript of which PCR extend events. >> My thinking is, since this mapping is ARCH-specific information >> and fixed by design, it makes more sense to hide this detail in the >> vendor driver than letting userspace configure it. If we allow users to >> configure it, there is a chance for incorrect mapping. > I think I agree with the fact that letting users configure that mapping > may be error prone. But I'm not sure this is an architecture specific > mapping, but rather a platform specific one. I'd expect the guest firmware > to provide it through e.g. the MapPcrToMrIndex EFI CC protocol. > > So I agree I should remove the user interface for setting that mapping, > and pass it from the provider capabilities instead. It is then up to the > provider to choose how it'd build that information (hard coded, from > EFI, etc). > >> Regarding the TPM proxy, I am still not clear how it is going to use >> this mapping. If we want to provide TPM like feature, it needs a >> special kernel TPM driver, right? Even if we enable TPM support >> with RTMR, I assume it can only support pcr_extend(). > Extend and read, yes. > >> Other TPM >> features should be disabled. If yes, since we already have this ABI >> for measurement extension, why again support it via TPM or did >> I misunderstand the use case. > I am not sure the TPM compatibility is always needed, but for subsystems > (like e.g. IMA) that look for a TPM as their root of trust for storage, > providing the extend+read ABI and the PCR mapping should be sufficient. My question is, do we even want to expose the PCR-RTMR mapping to the user? Even if we want to support IMA with RTMR, I think the mapping needs to be done in the kernel and the userspace does not need to worry about it. > Cheers, > Samuel. > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer