From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.11028.1637672859872735361 for ; Tue, 23 Nov 2021 05:07:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=BOu6ZIu7; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: jiewen.yao@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10176"; a="234965135" X-IronPort-AV: E=Sophos;i="5.87,257,1631602800"; d="scan'208";a="234965135" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 05:07:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,257,1631602800"; d="scan'208";a="509405947" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2021 05:07:38 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 23 Nov 2021 05:07:38 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 23 Nov 2021 05:07:38 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 23 Nov 2021 05:07:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAs5Uv/eQPewB6hlGXriV07ghTrWV4ivxIl04ok9f7gcIs9OjzZWn7h+WqhlLRK38NPjALU9tu5p8cjKs9AjI1c8LwPt+PD+m7GT0W3VPC/4tf3llp/45FKlfxxHjrFhhWGtVWNNQw+xDfOmHIy3NH/Un/AyKfMGalN9hUj3wXc20a7n3kyD/8hvh6uPzzTSMILAo6Oez8tab4sFZOzXxyaTZF1Kc3oLc6g6+1Y8hf4MqajKQbbGi1s4z1t8x/NVcQCxMUadELZiqW4t9xCKaU6A+An16J55moSEucKdRWr/AmcHX+DKotF9iWlE4/iSHAS39/soPXxNWPehj2dlSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tdNfVyxsuRZLCXAHlf6G0AjZyRi+h5zHAyCyylsFX7U=; b=Gr/S1AExw9vDtJLc4/XjVgBVM0E6/P961A64kJs6/wpNTCwOW+ZG59kv9zTZcYYbi/C2jxp7myyL5aJ1ZWOgg4qAXVGcb9jNdUKwK8q+VrPtCZZa9MLf894WeUu8qTN8d/xLlP9GQ/lSMzof4+IiCgrxzkJH2cXUxl8ubrvhxKU2G8Y5WSbvwlvQBa051LB+t6MzOZR1jRLQx5VhsdL3nilmChiAmaZJ2dQKCrWOGtdJnSC1CRabr9sHTFD1luIlI7UBrAuGPdZZIibl7mQQFKUerXQlRnVEsRGkA7RVzXHnzHBgVbJZDoWrVbxm/yrcOAOuObdbk7u8LPPSn98dWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tdNfVyxsuRZLCXAHlf6G0AjZyRi+h5zHAyCyylsFX7U=; b=BOu6ZIu7Sk0L0C3eGO+ohS1EMKoOO0/0nTvieRvkqVofLjUWjN0jNw7ug1bUuBkIx+ZFrvoqrwiZgjzRP1r2oLzrqdH6oCvTDGb9Ima2TyzgiSk3HD4Wy6N5y8fRpoGO2vn4KNR9HVelixFDjzRBj2hdOJOe5SxJBk05hkgpQzw= Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by CO1PR11MB4884.namprd11.prod.outlook.com (2603:10b6:303:6c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.24; Tue, 23 Nov 2021 13:07:36 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::1d07:d296:b2c7:7114]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::1d07:d296:b2c7:7114%8]) with mapi id 15.20.4669.016; Tue, 23 Nov 2021 13:07:36 +0000 From: "Yao, Jiewen" To: Gerd Hoffmann CC: "Xu, Min M" , "devel@edk2.groups.io" , Ard Biesheuvel , "Justen, Jordan L" , Brijesh Singh , Erdem Aktas , James Bottomley , Tom Lendacky Subject: Re: [PATCH V3 15/29] OvmfPkg: Update SecEntry.nasm to support Tdx Thread-Topic: [PATCH V3 15/29] OvmfPkg: Update SecEntry.nasm to support Tdx Thread-Index: AQHX2uMZH+dNhguCw0OBghbxJplRDawH11AAgAEwN+CAAfIoAIAAvv7AgAVfi4CAAAXBAA== Date: Tue, 23 Nov 2021 13:07:36 +0000 Message-ID: References: <867e8a2aaf28c308b20a659057217453c6e38e00.1635769996.git.min.m.xu@intel.com> <20211103063045.kmttoxyluifwo2bq@sirius.home.kraxel.org> <20211117151942.iqow75zq2lrn5xlc@sirius.home.kraxel.org> <20211119151130.g2wcnuhivt3lxvzi@sirius.home.kraxel.org> <20211123123821.q4fanslttg72n2r3@sirius.home.kraxel.org> In-Reply-To: <20211123123821.q4fanslttg72n2r3@sirius.home.kraxel.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.200.16 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ef6ea3e1-abd6-4ceb-b983-08d9ae823884 x-ms-traffictypediagnostic: CO1PR11MB4884: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Y2BHySkvscmT5kmHs8gXMxMRp+VwrbLWL40rRVxYiGo8b9bAfURDu3Eb/2CQoia9BwjG6vwlNAfMezLuPoZEYFSZEEdpGiD6dDg6NIdUKj8zAi4Td6K4AcmdmokcsNsC8rjPBlG41xF0nv9VGnYXtzqCuWermLiHkeHxp/lgE2+WOMWeKi+qIaUt/HPsIRLdk24tluCe3cndjwXEqtzpEIvYwMEwzbw/tCFHedmpq5ACFBi4CIKxmLYY4Fk0IbCnVIKO7yj4eu22ivOpFwzIlP4g8PmPcT2F2BPrdtQtteHsSnNoFJYWz73CFf6XBKvMq7Xms4Tevq/uHkyi287wxdOe91XP1SDN2l96AyzSGETfC2vx2ycVlCUJs7A2RTY2EC8vxK2E/p4P0lebG6oa3HvYDbT2mMIymxFl21DK+HtPiw9hbqd69rtVfwmiHt5ekq0Z2SVfJjMLcdi/+PbTuqRbCSuyI1cMo8MVKQyw6aTosNHCLfhjs/LcC8VQDC2jdqBlJ4TJrfNHUAzgX0hNoxVFsMCGapopcoTCC1pg4tFq40JV1wt3/089UVgrSvDl8wk3P/EDXP6g7ESMtYo9yqHnqhA6LacHq7w01SXDC849pq0UMVHcQtsVLdTxwnEUCMcX91UxEf1NhObxg2TAeFmXva56KB56nOgIep5FDIgQjcgHTckx1p0w35HcMaCAs4PslqSCm7XFbXuTct7mnA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(7696005)(4326008)(9686003)(5660300002)(53546011)(38100700002)(122000001)(66946007)(66556008)(64756008)(66446008)(86362001)(6506007)(6916009)(33656002)(82960400001)(186003)(26005)(76116006)(2906002)(15650500001)(54906003)(508600001)(8676002)(52536014)(38070700005)(83380400001)(8936002)(66476007)(55016003)(71200400001)(316002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?EBOADIIgfQQudxNmxPT+zLvIFCHXh6rT5SSz6cxX91lFiz1XR62OUsFz+Url?= =?us-ascii?Q?xRTNJ28Pm5YDz8YJC4L7M/zgd8Y8diSmQyyqwDp930A359QNcdd5oTCvjCnY?= =?us-ascii?Q?3FHTJvBlK1RdABHl09pYR6Y+R1V9oL/cqrdxvwcYn179h0hlitGA7sx1pzW3?= =?us-ascii?Q?2UI3j1V4HyD8jhFk20x3eQbdkww2PuhpKIrNPA2jbP1UVzzjF+8cViz4izWH?= =?us-ascii?Q?Rl9O1T9xWa3sR6VNPCJZ93vz1W9hqdGPnvgC8FHTU2yuPn5mcTu0thfwGirS?= =?us-ascii?Q?+GqfPTqIS4/7fk4zWurDnLQ13cOYh1eU85MY31Z4XK+uFGSGVsIn2YqKiIcr?= =?us-ascii?Q?43j+RCq2gkeZ/WAgK2qQireJHT4MMacNtQXIXc0CVwWBk37S5uUpdMbqnR4T?= =?us-ascii?Q?fTVCGezcJMaBlQ0CH5vlrgTNSbn5YZ8UiGO6/cNcMGIQLLF5gexNrhInzOMF?= =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/ENmHieC7OwkH53c791eG6d4YWIBX?= =?us-ascii?Q?Vd9anKpN4Ns45+0YF4msWXfJ7Huwj0hGQjRSTBJaEGjMUoAho4wjaeZrcTOO?= =?us-ascii?Q?l/QTnMs1t7ipsykRs2GVMZ/Ly2eCZSSJOixFpbBkkQZMfiWYNqs8Pnsv3YuL?= =?us-ascii?Q?9v11El6n/nou7yYYvwKw7fbIhn4tuPNjTLABqoiJ1buiAl+KOSPbv/AtPJSh?= =?us-ascii?Q?2K7o5iiDT57xbSNakr3PC8ls83iGC2aaP5a0BYfE+US1QAEMcTuFI5uTA0Hh?= =?us-ascii?Q?yMm0aeQNRhgBcREjFhQ1kc8=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef6ea3e1-abd6-4ceb-b983-08d9ae823884 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Nov 2021 13:07:36.5127 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ePh8feNYN9yUeAqZ5A0dUIvL/GgdZo2s75Tthzjrop3cxHUCDToBeJ1X2NPuFbQo8q2Rc7cthkxhGqa0/RVHsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4884 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Comment below only: > I am persuaded to let config-a adopt the OVMF way, because the threat mod= el of config-A is same as the normal OVMF. > But config-B is NOT. > Different threat model drives different solution. > I completely don't understand why they must be same. I don't understand why you want separate them. Improving OvmfPkg security is good for both OVMF and TDVF. For TDVF it is clearly much more important due to the different threat model, but it is good for OVMF too. Likewise edk2 in general. [Jiewen] My answer is very clear as I mentioned multiple times. The threat model is different. IMHO, talking about "Improving OvmfPkg security" without a clear threat mod= el is *meaningless*. All mitigation must be based upon threat mode and security objective. Otherwise, what you are doing might be either unnecessary or insufficient. > If you force me to add PEI to config-B. Finally, that causes TDVF config-= B is compromised due to an issue in PEI. > Who will take the responsibility? Will you or RedHat take that? Bugs happen. There could also be bugs in the additional SEC code you need for platform setup in a non-PEI configuration ... [Jiewen] I agree. That is why we need smaller code. We can just focus on review that small portion of code what we have written= for TDVF, instead of the whole PEI. We have process to review and maintain the extra TDVF code. I think it is totally *unfair* that you force me to add PEI, without knowin= g the quality of PEI. Thank you Yao Jiewen > -----Original Message----- > From: Gerd Hoffmann > Sent: Tuesday, November 23, 2021 8:38 PM > To: Yao, Jiewen > Cc: Xu, Min M ; devel@edk2.groups.io; Ard Biesheuvel > ; Justen, Jordan L = ; > Brijesh Singh ; Erdem Aktas > ; James Bottomley ; Tom > Lendacky > Subject: Re: [PATCH V3 15/29] OvmfPkg: Update SecEntry.nasm to support Td= x >=20 > Hi, >=20 > > > That totally makes sense. I expect TDVF Config-B will look alot like > > > the existing AmdSev configuration variant which is stripped down too. > > > > [Jiewen] I don't think TDVF config-B will be like the AMD SEV is right = statement. > > TDVF and SEV are two different platforms. >=20 > Yes, of course. But even though there are differences in both > implementation and supported features both platforms have similar goals > and there is quite some overlap in concepts too. >=20 > > Intel mainly focuses on TDVF and we will let AMD defines the feature > > set in SEV. They MAY be alike if possible. But difference is also > > acceptable if there is architecture difference or different decision > > in different company. >=20 > Yes. Whenever they are close enough that merging them makes sense > remains to be seen. >=20 > > > But I don't see how dropping the PEI phase altogether helps much in > > > stripping down the firmware image. The initialization currently hand= led > > > by OvmfPkg/PlatformPei must happen somewhere else instead. Given SEC= is > > > a very restricted environment I don't expect the code can be shared > > > easily, so we will probably end up with code duplication. Also two > > > different boot workflows which I fear can easily introduce subtle bug= s > > > due to differences like a initialization order changes. This is what= I > > > see as maintenance problem. > > > > [Jiewen] I don't think this is right statement. > > In Tiano history, there were security bugs exposed in PEI phase, even t= he PEI > Core on FV processing. > > I do see the value to skip PEI core. >=20 > On the other hand there are probably more eyes are looking at PEI Core > because it is used by a lot of platforms, increasing the chance that > bugs are actually spotted. >=20 > > Again, I am very familiar with non-PEI flow. Back to 10 years ago, I > > was maintainer of a non-PEI platform (named DUET) and we jumped from > > SEC to DXE directly. I don't see any maintenance problem. >=20 > The maintenance problem isn't a non-PEI flow. If a platform chooses > that -- fine. The problem having to maintain both PEI and non-PEI > workflow. >=20 > > [Jiewen] I think we are debating two different things. > > Your statement that "config-B is similar to AmdSev" does not support > > the statement "config-B should be adopt what AmdSev chooses". >=20 > I never stated "config-B should be adopt what AmdSev chooses". >=20 > I stated "TDVF boot workflow should be simlar to the other OVMF > platforms to simplify maintenance". >=20 > AmdSev is just an example showing that you can easily strip down the > firmware build without putting the boot workflow upside down (which one > of the things config-b wants too). >=20 > > > I don't want question all that. I still don't see the point in dropp= ing > > > the PEI phase and make config-b work different that all other ovmf > > > variants though. > > > > [Jiewen] My point is simple - Threat Model is different. > > That causes security objective difference and design difference. >=20 > Does not using PEI phase have any advantages from a security point of > view (other than "not using PEI Core code which might have bugs")? >=20 > > > The security workflow is a serious problem indeed. Not only for TDVF= , > > > also for OVMF in general, and other platforms too. We should certain= ly > > > try to improve it. > > > > [Jiewen] If you look at how we state config-A and config-B again, you w= ill find > we made difference statement. > > I copy it here again. > > 1) Config-A is to keep current architecture, to maximum compatible with > OVMF. And we don't remove VMM out of TCB. > > 2) Config-B is to have a new TDVF design, to maximum satisfy the securi= ty > requirement. And we remove VMM out of TCB. > > > > Because of the threat model difference, in config-A, we can safely > > make some assumption that the VMM is benign and VMM will not input > > malicious data. As such, we might not perform data validation. We just > > trust VMM input. > > > > However, in config-B, VMM is malicious, which means we need be careful = to > NOT trust VMM at any time. > > The code in config-A and config-B may do totally different thing to han= dle the > difference situation. > > > > I don't think it is hidden assumption that if TDVF need do some check, = then a > generic OVMF need do this check. > > If OVMF trusts the VMM, the check might be totally unnecessary. >=20 > Do you have a concrete example for that? >=20 > I can't think of a good reason to skip checks on OVMF. When we -- for > example -- review and improve virtio drivers to make sure they can't be > used by the VMM to exploit a TDVF guest: We surely would use the > improved sanity checks on OVMF too, for better OVMF stability and also > for better test coverage of the sanity checks. >=20 > > > Hmm? Seeing TDVF as "other platform" is a rather strange view given > > > that we are integrating tdx support into OVMF right now ... > > > > [Jiewen] This is how Intel views the "platform". > > In history, we call this one binary mode is "multiple-platform" or "mul= tiple- > SKU". > > That means we only have one binary, and this single binary can boot dif= ferent > platforms, which has similar CPU or silicon but different platform board = design. > > And there will be platform specific code flow, such as > > Switch (PlatformId) { > > Case PlatformA: > > {do platformA init} > > Case PlatformB: > > {do platformB init} > > } > > > > If you treat CC_TYPE to be platformID, it perfectly matches. >=20 > Yes. We have that in quite a few places. IoLib for example. > It's required for Config-A, obviously. >=20 > So, what is your plan for IoLib for Config-B? >=20 > > Also a platform may has extra module (a driver or an FV) to support > > the platform specific feature. Or a platform may much simpler design > > and skip some drivers. >=20 > Sure. Config-A will need some drivers from OvmfPkg/AmdSev/ so both SEV > and TDX work, whereas Config-B will not. >=20 > > I even propose config-a skip PEI phase. >=20 > Care to back your proposal by posting patches to the list? >=20 > I think it's easier to discuss the advantages + disadvantages > with concrete code at hand. >=20 > > I am persuaded to let config-a adopt the OVMF way, because the threat m= odel > of config-A is same as the normal OVMF. > > But config-B is NOT. > > Different threat model drives different solution. > > I completely don't understand why they must be same. >=20 > I don't understand why you want separate them. Improving OvmfPkg > security is good for both OVMF and TDVF. For TDVF it is clearly much > more important due to the different threat model, but it is good for > OVMF too. Likewise edk2 in general. >=20 > > If you force me to add PEI to config-B. Finally, that causes TDVF confi= g-B is > compromised due to an issue in PEI. > > Who will take the responsibility? Will you or RedHat take that? >=20 > Bugs happen. There could also be bugs in the additional SEC code you > need for platform setup in a non-PEI configuration ... >=20 > take care, > Gerd