Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2706330rdb; Mon, 5 Feb 2024 15:24:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEM25x9EdQ3mjdrEIYRPy6il1PWqk7skWgQMe2yDXD0AG4Oxufp/aki9xoL1BDzmp+WGusO X-Received: by 2002:a05:6a20:9187:b0:19e:3c4e:d097 with SMTP id v7-20020a056a20918700b0019e3c4ed097mr633048pzd.31.1707175467444; Mon, 05 Feb 2024 15:24:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707175467; cv=pass; d=google.com; s=arc-20160816; b=ojy37f+Eo3BT96I4FF9iEPXu+5c+hyit/yCpEeJUDkOTb2b8BVc8B/0mGDfSuAXLUB 2NB9Wi+K1/Nsen3JDtejQAMBFJRoJA4J7cIqtax4+Li1qGoAWTHDlEQ+T0QB+Bu30dsL n8sEKtCk22VjtT9NtsiUc0z8b8mQD/MsPgW0LGcUC23txvew50VItwQyv+uowBOJg4w9 hkpapT7ds2jy7vGjL2OggJ3zeQmYUieNyvdE5gWdJwQsIzsC3pV3ntwXsHaY4Ct+GrTn iSECFPhcMJriEID5hf2E+8kBV8/5RWAx7ER0AUKMEcvU94h6jkVXACCheujWGr6xTMk2 kq5Q== 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=AKyllVRbWTJ8SqdFOrF5DsuN65TvswIw3T2jXIh92SI=; fh=OmRWalAxUoQ8Y4Bxw5q4bBbnlkeqDr0rsIm4MRdv3r4=; b=Ey9mxg7NsiZ/k5GVJ53cVJQHVGKBhtrGj4DHLZ/yYyvzC4CCfpV8r+v75CfnhDQ/zd AfSVRBX1pySRGbiSPMC/Dwa2V+yjJW96ImHJBRe6T9PzdDRcGsT/ERoWRukPDk+GZ4L/ ayEhFQpvsZ20dCWdEV0U2x4NZ9Dvdi4XDioZfRCYersK2ogqy/65k/4sEhnu6N9rURF+ jN8bz4oKGW5+5mbf4rurOZVz3m2dIUkqaNLjHHPy8XxuHdxJzCpx0IoC6vl9ht7SoTxs bGwI8Y66zS64y7LMwVQPvMKJS+sUjphKxCwJJF532y5WIyPth0sc+ENQdbrlZNP+YlTM jTSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8hT8ZOU; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-53902-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53902-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVzHylD1jRhtvnrdvkUk7ONRxtKovLwoGBHuysaeIsFTO8jNzHk2b7IYvKkTILoGZT8rUWNG1rJCXxBLlulxOEAKt/XaH8VvUfvxC+FFg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y16-20020a62f250000000b006dbce4a7c80si494922pfl.397.2024.02.05.15.24.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 15:24:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53902-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8hT8ZOU; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-53902-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53902-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 5E381293C20 for ; Mon, 5 Feb 2024 21:43:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CE89130E3F; Mon, 5 Feb 2024 20:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="J8hT8ZOU" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 B30D0130E34; Mon, 5 Feb 2024 20:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707164024; cv=none; b=fPFwNoNS2f7/yctmA0JdhqQCraV5s9PlDLarjaW+22+vv7OOfFwuUH2CZuqYPalWgvX41X/N+i/01TxEH+/PzXtkuwke17+hs/L1Rp/YwWkPIqiFMQQoFp21TFzJiQPYt8CoCpWd7fbe0ibGdNyWR+xgptqOZ53WviqqcbtyAtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707164024; c=relaxed/simple; bh=2yih0opNne/Q0VVz8BpBMmldQxIFKnPYj/oBNJL89CI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TC2IToofSjkQcdX5+SMdHpNHsI9CZk9gcNammkFfHDNZzbengNsyf3jb34c7PAcIJH9opK24rxc36/8W20z3QxLMyjt9e0P120UgUYjBpm+DlOd+K3bgVMO4zratEAcP1tOwyKnJkFqRagmDircvMZoUCkkPnUvZBOPp7p4E3ZY= 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=J8hT8ZOU; arc=none smtp.client-ip=192.198.163.14 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=1707164022; x=1738700022; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=2yih0opNne/Q0VVz8BpBMmldQxIFKnPYj/oBNJL89CI=; b=J8hT8ZOUU0hkeB+oEzJFa1u6pFycEbnvGZKv4pURmtf+BcoDedtW65kC yBDxp+Uxi1KKk/vvFH/fqkzmCrQgOccD9w+Q5iOxwp9XcuXyz6NfSGm9y RSXvAEASoxS3+dI7I/NoLhvAH8SNqxAwJ87smuzd2XWhZoxapty6EL3wM +4PdEJsJ4WZhB0jS1MFx6/vIHgraFF4oJyy+WzddJhFFLRJQ0xneC3u1G 6f5IYS4B7QPmUspnPWbvIj6K9k2oxMYV50cwytihU4Hqnyhoc3dYm8IS4 LbQc9auBxWI9uyOjqLad9O9RabEMU19TvkKF71RaqJiYkilbIfS2uDoqT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="751228" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="751228" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 12:13:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="909394756" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="909394756" Received: from vmsundar-mobl.amr.corp.intel.com (HELO [10.251.2.9]) ([10.251.2.9]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 12:13:41 -0800 Message-ID: <7241153a-626d-4ea5-ab9e-d6842b662064@linux.intel.com> Date: Mon, 5 Feb 2024 12:13:40 -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: [PATCH v1] efi/libstub: Add Confidential Computing (CC) measurement support Content-Language: en-US To: Ard Biesheuvel Cc: James Bottomley , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, "Yao, Jiewen" , "Lu, Ken" References: <20240203075736.3982371-1-sathyanarayanan.kuppuswamy@linux.intel.com> <82a84e769875c70279348179c1b2b63a16770c8e.camel@HansenPartnership.com> <6a696340-b57c-4fa5-bb2e-b3a0257453bc@linux.intel.com> From: Kuppuswamy Sathyanarayanan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/4/24 2:03 PM, Ard Biesheuvel wrote: > On Sun, 4 Feb 2024 at 21:28, Kuppuswamy Sathyanarayanan > wrote: >> +Jiewen & Ken (RTMR firmware owner) >> >> On 2/3/24 10:46 PM, James Bottomley wrote: >>> On Sat, 2024-02-03 at 07:57 +0000, Kuppuswamy Sathyanarayanan wrote: >>>> If the virtual firmware implements TPM support, TCG2 protocol will be >>>> used for kernel measurements and event logging support. But in CC >>>> environment, not all platforms support or enable the TPM feature. >>>> UEFI specification [1] exposes protocol and interfaces used for >>>> kernel measurements in CC platforms without TPM support. >>>> >>>> Currently, the efi-stub only supports the kernel related measurements >>>> for the platform that supports TCG2 protocol. So, extend it add >>>> CC measurement protocol (EFI_CC_MEASUREMENT_PROTOCOL) and event >>>> logging support. Event logging format in the CC environment is the >>>> same as TCG2. >>> Why do we have to do this anymore? Given that you're already pushing >>> patches that map RTMRs to TPM PCRs: >>> >>> https://lore.kernel.org/lkml/20240128212532.2754325-4-sameo@rivosinc.com/ >> IMHO, I am not sure whether we need this mapping support . I have already >> mentioned the same comment in [1]. If we support extension and logging >> via configFS ABI, why again support PCR mapping? >> >> https://lore.kernel.org/lkml/2bd7c80b-9cd8-4450-a410-c3739d224167@linux.intel.com/ [1] >> >>> Can't you just add a stub TCG2 driver to EFI that exposes only the >>> ability to log and measure using this mapping? That way all our >>> existing code will "just work" without the need to understand anything >>> about confidential computing or add new code to do the measurement? >> I am not familiar with the EFI implementation, but I think a new protocol >> is added to handle future CC extensions (which could deviate from >> TCG2) and to support platforms that does not support or enable TPM >> feature. So modifying the TCG2 driver in EFI may not work for the >> above-mentioned cases. I think the EFI driver part of this support >> is already merged. >> >> Jiewen/Ken may have more comments about this proposal. >> > I don't think it is sufficient to wire up the CC protocol here. There > is more code in drivers/firmware/efi/libstub/tpm.c that deals with the > event log. > > Given that the EFI CC protocol was specifically designed to act as a > substitute for the TCG2 protocol, I would expect all occurrences of > TCG2 protocol invocations to be handled accordingly. > > So I think the approach here should be to provide a local wrapper > around get_event_log() and hash_log_extend_event() that is backed by > either the TCG2 protocol of the EFI cc protocol, and all current > callers invoke this wrapper rather than the TCG2 protocol directly. Ah, I missed that part. Thanks for pointing out. I will fix this in next version. -- Sathyanarayanan Kuppuswamy Linux Kernel Developer