From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.58866.1680481308662019824 for ; Sun, 02 Apr 2023 17:21:49 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=cCrdRENK; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680481308; x=1712017308; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GZ3GSvHS65PvMMTl362H1fyU9/rcntsmRphP3WnuA2E=; b=cCrdRENK3LVcsSm2wJ7veEpHmpdfLMpnCgFaguqHA9j1fWLVIGuajrCZ f0YdaWtXj8AnzW2JqCMYM2iHHF+AR2jyMQaW6x3wDBjjcyJ/+UdRVVlEB UrErXG1qvkARFSHwT0vttgDIAqRfJYdw/C8OmW21i/2QZdov7KD5gh4A5 HRG4z3FOMDSSBHDUK0oVjorxCY5jmqTT7V1BmXePFiWxZbdlFAXRO3+Ba g4d8B21J9L/hvDX79yFhiD2x8M3mAprh6YyPgDDgmW4mvb68DR12P8tUp H15si4COK/vuIa7+QAqivurCPaz2laaT4OJA25ho2ucyLbSiTeBtwKGCd Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10668"; a="339275483" X-IronPort-AV: E=Sophos;i="5.98,313,1673942400"; d="scan'208";a="339275483" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2023 17:21:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10668"; a="635919426" X-IronPort-AV: E=Sophos;i="5.98,313,1673942400"; d="scan'208";a="635919426" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga003.jf.intel.com with ESMTP; 02 Apr 2023 17:21:47 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sun, 2 Apr 2023 17:21:47 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sun, 2 Apr 2023 17:21:46 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Sun, 2 Apr 2023 17:21:46 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Sun, 2 Apr 2023 17:21:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lHAU0QclQDc+o9EugujsSHdjgT4gB7Z0YjnRrOLLlrdj7QtT5mscbXkYKjYZpW3kz7vqr4M2J7A9+Ko1fl59zjYTYIQNYR4yex5fOr4fhETDm3zomGH95JthU6WHXzVLoxGEWvDYXeSxm8f8ekZ8+m30VUy/G+d33hGbwh6NtdCh77D0t0jRhZ/mYJU9xOoYEBpUtyVyNinIe/ht0GyaxUmfTIwPRb7N9Qj3QZ09zFdan6ZXOzkRfHB/Bus+Eony11Zt2C4SoSt34tnYQKr7P1jiIxm4iPBhUeL+Pq8YwWkPhXvcUjUtTkcWiU3fcdWfiFl1086r8n2+Vap/EDp0ug== 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=Wjbv2rhLvyK+mglcU9xO1OriDyHcaR7cmCqLNYtGecI=; b=Wt4eY0TJ+/5YaOKLPNjEI+CJiV+bns416o30x288j24q1XzYICcfkkvpv8SrQARwQIbdO8997v180KIIIEeEh+6oRzeVobeXpkV+yt/lO/hwEHEsj7iiLLXyiDbz5esoZYYeiT/y7QlRTN6URCsoLJfkyQsJ05b41PfREkwdejBT9HTxsKCFdkpWFsNRUovGXv2k/0NNEbwnkV0MrpZUgMh2DgrAveaA5Ct9jORYwpLeqw75Kfo1y8VpQvALdQWwdYg3MZYr/C9vcbMmgTqLN01nha7VDfgbXIwAPgAu2Cxn+m6bVR+kzB6uxYng0CjDHB6y1+P/RNQX7mEcrhfO8Q== 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 Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by SJ0PR11MB6816.namprd11.prod.outlook.com (2603:10b6:a03:485::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.29; Mon, 3 Apr 2023 00:21:39 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::6364:feb3:108:a5ee]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::6364:feb3:108:a5ee%6]) with mapi id 15.20.6254.029; Mon, 3 Apr 2023 00:21:39 +0000 From: "Min Xu" To: joeyli , Gerd Hoffmann , Tom Lendacky CC: "devel@edk2.groups.io" , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Michael Roth , "Xu, Min M" Subject: Re: [PATCH V1 1/1] OvmfPkg/PlatformPei: Skip PlatformInitEmuVariableNvStore in SEV guest Thread-Topic: [PATCH V1 1/1] OvmfPkg/PlatformPei: Skip PlatformInitEmuVariableNvStore in SEV guest Thread-Index: AQHZY9/upZdLU6tINE+BmUa1CmQ25K8Yur2g Date: Mon, 3 Apr 2023 00:21:38 +0000 Message-ID: References: <20230329052310.27-1-min.m.xu@intel.com> <4tmi32c3kevecoc3y7mb6jlv7d7ygmctt6bgwflvjybqwphjqk@gnnertcj5kz2> <20230331075956.GJ8569@linux-l9pv.suse> <20230331144834.GK8569@linux-l9pv.suse> In-Reply-To: <20230331144834.GK8569@linux-l9pv.suse> Accept-Language: en-US X-Mentions: jlee@suse.com,kraxel@redhat.com,thomas.lendacky@amd.com X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5064:EE_|SJ0PR11MB6816:EE_ x-ms-office365-filtering-correlation-id: d5582f73-7207-4e5e-a5e4-08db33d96460 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4Y/OQX8g24SqBf8ygi6ui2wnj82r8SAOjZTUHAWv0simVYQLzUVFiYKzjG/cpsoDmnhRgvpkc9bP0E7Vq7UxdsAUln7FHqHyUFs0f7BM4PJhlxlctXJtpW3KBr8Wg1TZQ3Sca+C/GCQlmvcxkx9IUELz/WSBo1c2USGg+lJTy5Ab2huFSgWjcC8xLuUN69x8wyIoOx5mPx9OzUpVtWcdAj/K3MklEmpIQBY1zxO1XCBVzKq2vQ3Z2uvD1UIyEtkLt+1oRP7nHY1oKgIlS/HtwzT/rJovJhpykZ7Y95LHRLHn9elECNqmwZpkWVdC/jkH9S5BWK+7Y6fggeeREM+I7UoRzxrssj9kV2vanUK4YooXXXQbgzDriqg+n0IM3L3GqOoavMcQQf61CzCa+f3VXGarspZhBqL4Ys+7zXYmhXeh59B6sPbA6f/EHhPUw/UfjVNWgfiMHTwiWrewKr2+0CAIdTKn09oc4lM1OmYlkaVsbjTYd96uB6DaB4aGWt0BPNb7wJuiHfnxHO8tlKZNnC3B8hQ73jfNeq6tpByDUOLIQAteNCe6W6dt0LBEThNq95v+GVSuAgHQfxn76rgCG1zFIu5Roia+w3A3mywBgFo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(396003)(136003)(376002)(366004)(346002)(39860400002)(451199021)(55016003)(41300700001)(8676002)(4326008)(66476007)(64756008)(76116006)(66946007)(66556008)(478600001)(66446008)(316002)(110136005)(54906003)(8936002)(52536014)(122000001)(82960400001)(5660300002)(38100700002)(53546011)(186003)(83380400001)(7696005)(966005)(71200400001)(107886003)(26005)(9686003)(6506007)(86362001)(2906002)(33656002)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gPkNcVNIqYQ172xLSW4W0mSpmoUdoYSinGrO0fLaOFUIAehVCG3otJwi4kGp?= =?us-ascii?Q?o1pJkFbVq3NPKnIFtBiJfRRKneiLrXBI3BmsbdHUmcjlIThjXpRn53zwfcd5?= =?us-ascii?Q?UjeEAWA/ySgtMF02MRAOOVNZ+MIBIvLOjVdlGw6d87ve6YtXRbtRosk+IBq9?= =?us-ascii?Q?R4EIsYbtLrsnziPFUzYMJatQ/IfgwA3z0X/uVXIh9G8hHmG1shTbc34HytCu?= =?us-ascii?Q?K8WjODEKPGA1sXAPi3i3PjcipCKY7H23+T63cMerZ+U7b11GgFMGQ961liMO?= =?us-ascii?Q?HHnG8xsjs5WNXxDYTo1/0aT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?us-ascii?Q?w+2Mz1/TJa2milfLuYK4NHKISmTmOgDg8CSngii12IhaufR6ywMCEWOhalAk?= =?us-ascii?Q?rbVnI/Fd/zeSWD3Emr0ioDsB1gfDQ0HUEX2DZgvl6rjnBV10atBjDlhaaibH?= =?us-ascii?Q?TQDGlEXWPFdK0lhwTrsug2SPpUu8IORGmUEu3jje6GUPvd4CzeYB4UYAJW6p?= =?us-ascii?Q?NMSOyO+pVHwYp/BcmNYIYFIvejhKPO5QT5/8AzycGgtf0+bVL4lLoqfFz1Zr?= =?us-ascii?Q?prFsevel1xGd0dYY0wA7M2cPejuZzb+gUo5gNBl3lZr7MK/fzkywlQ9wfOog?= =?us-ascii?Q?npsg6l6E3klwo69k3b1o5PlDYeXzEVnF4TehgdyASSIvS22iLgXbZ8GvUuUS?= =?us-ascii?Q?R7dvcqfWmxCtDab0KPjFPg7jSa37ZKKpct3iSxIO?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5582f73-7207-4e5e-a5e4-08db33d96460 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Apr 2023 00:21:38.7824 (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: TTeTYJMDTxv6q3MMYsU2yNwTDzo//AgYvfHlG9djma3qew/uo2VjuwGYB3Y5aQzkI7PVjARcmh3EXKREX/4tEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6816 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Friday, March 31, 2023 10:49 PM, Joeyli wrote: > On Fri, Mar 31, 2023 at 10:25:09AM +0200, Gerd Hoffmann wrote: > > On Fri, Mar 31, 2023 at 03:59:56PM +0800, joeyli wrote: > > > Hi Gerd, > > > > > > On Thu, Mar 30, 2023 at 09:50:53AM +0200, Gerd Hoffmann wrote: > > > > On Wed, Mar 29, 2023 at 01:23:10PM +0800, Min Xu wrote: > > > > > From: Min M Xu > > > > > > > > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4379 > > > > > > > > > > PlatformInitEmuVariableNvStore is called to initialize the > > > > > EmuVariableNvStore with the content pointed by > > > > > PcdOvmfFlashNvStorageVariableBase. This is because when OVMF is > > > > > launched with -bios parameter, UEFI variables will be partially > > > > > emulated, and non-volatile variables may lose their contents > > > > > after a reboot. This makes the secure boot feature not working. > > > > > > > > > > But in SEV guest, this design doesn't work. Because at this > > > > > point the variable store mapping is still private/encrypted, > > > > > OVMF will see ciphertext. So we skip the call of > > > > > PlatformInitEmuVariableNvStore in SEV guest. > > > > > > > > I'd suggest to simply build without -D SECURE_BOOT_ENABLE instead. > > > > Without initializing the emu var store you will not get a > > > > functional secure boot setup anyway. > > > > > > In our case, we already shipped ovmf with -D SECURE_BOOT_ENABLE in a > > > couple of versions. Removing it will causes problem in VM live migrat= ion. > > > > Hmm? qemu live-migrates the rom image too. Only after poweroff and > > reboot the guest will see an updated firmware image. > > >=20 > Thanks for your explanation. Understood. >=20 > > > I will prefer Min M's solution, until SEV experts found better > > > solution. > > > > I'd prefer to not poke holes into secure boot. Re-Initializing the > > emu var store from rom on each reset is also needed for security > > reasons in case the efi variable store is not in smm-protected flash me= mory. > > >=20 > I agree that the efi variable store is not secure without smm. But after > 58eb8517ad7b be introduced, the -D SECURE_BOOT_ENABLE doesn't work > with SEV. System just hangs in "NvVarStore FV headers were invalid." Hi, Joeyli ASSERT is triggered in DEBUG version. In RELEASE version ASSERT is skipped = and an error code is returned. So system will not hang. So another solution is simply remove the ASSERT. Then an error message is d= umped out and system continues. @Gerd Hoffmann @Tom Lendacky @joeyli What's your thought? Thanks Min