From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=104.47.40.70; helo=nam03-co1-obe.outbound.protection.outlook.com; envelope-from=brijesh.singh@amd.com; receiver=edk2-devel@lists.01.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0070.outbound.protection.outlook.com [104.47.40.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8CE8E21CF58C4 for ; Thu, 5 Oct 2017 11:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lKJyf7Z+wZACIwmUqAD8+93bQQT3L10wpjO5S+FuwDE=; b=KtRdjmFz/RqdFfnkjSelNRg6N0xH4XyuvxGZggPvz4euV67MOEp5q5ZzxHdc4ORrT2A572yCWKkBOjDfJGrEIEHJc5G6y5ys+XjBFYtSApNxr1Yq/bd0Zxn4ui2LEEmZf0ImP25/K+s+3ScE+PRBETmplUY9qRE9vKjLRGghWFY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 5 Oct 2017 18:49:03 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Chao Zhang , Jordan Justen , Laszlo Ersek , Tom Lendacky Date: Thu, 5 Oct 2017 13:48:48 -0500 Message-Id: <20171005184848.94432-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171005184848.94432-1-brijesh.singh@amd.com> References: <20171005184848.94432-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR04CA0031.namprd04.prod.outlook.com (2603:10b6:300:ee::17) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27f88a28-8d69-4560-6458-08d50c21c03b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:nc7TESTC0u8jr1Zds+X6JlJNByttceF8xZGvCiBUbAkhHtkSr2927ppfg2Ha98lBQyj+uRqhyZvyUYyS0yNzrQYjGWuF66zSveTBrOfF8TSwiHr5KAosjblFnr4ncT+VAZSGuWBJk6EOt5FIPfXn1Ty3G+lYoim9kDT9OfA3OwW5ezQvfXEoP0p4xfcde6QYYXOBIZbvPyWMhoobr14o4vjULzbUDnNG/LdVRyBsdecRCLPXAzRyK0TQzkDhcO1G; 25:8BDvSBVGH4F5dSF1XoGG86mvuZX3ccW6Un1RJ4DwXiFeF2EmbDiA/yfdkmCVio2xWjutq0lN8XNIdbWC8hlpYhTaavLK4Se7r1KgO3hZ8fHP4TRElWWvJodBGGEHb4QkJhEP5yLyq8u3r3dCQSYJ4V+pxOiSYupONRFAaU9aeMw9zVnwuA/pqN0mc2f5u6Z4K/p1uQRlHxf0IjF/lzmDZB+1VOs7H6MP+zT/hjh4QusoesrH6D6dLYU4BdqhNwqzoYH8AK9OWIOQPsqGJGdnVMqAbvGAF6RQQBTbvJM6rfEDVrmwEgEnGZLt8f+tomy9qloA9q5qxLv61EClWpP1wQ==; 31:pl4QqrNNOXTdf2EqnuDqZyZGw8On48mdNKxee/DHxoqEaL8sfeyU7cL7iD9YSjx23WPuT27ave0XoIaiENN8fz28YuS+NOSOv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bicUF8qSs/q6qyrCOPHGqg= X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0156; X-Forefront-PRVS: 04519BA941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(199003)(189002)(68736007)(478600001)(25786009)(5890100001)(53416004)(106356001)(105586002)(50226002)(47776003)(36756003)(66066001)(189998001)(6666003)(6306002)(6486002)(2361001)(2351001)(8936002)(101416001)(50986999)(966005)(76176999)(4326008)(53936002)(316002)(6916009)(81166006)(2950100002)(81156014)(50466002)(305945005)(97736004)(48376002)(86362001)(5003940100001)(575784001)(2906002)(6116002)(16586007)(3846002)(33646002)(5660300001)(8676002)(16526018)(54906003)(7736002)(1076002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:oKLDSw58Y55CldaCC+Dksuw8qC5W2JiisksBaYJnI?= =?us-ascii?Q?uNQIfjU8k76VgVw55k3ZZ89mVl5emQUT632uI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B/IaedHcUoIlRqp9e8JIyG689PrFZ/TMUzWFbvyXWhHzv/emcaReeMTldKtZd8mJCOiZOHnlqSPVQ+NVJXofb2qLmUJzDdYvH2EHQdqNn4LuuNtIQCCeEtjTKjYcEwoIPZppKUgbjjE7RBinDzheaKficWciEUNU2DXmQat2Vi/b1IkIEGXt99Gispmj/aLM+fKV/0AAzlZ3SFDQRteI5h2uSn7A01aU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:K8jN9n1Q1kWZyGSsatRsLS4UtmU6OGKzZc0aHiyuTGWS3CqNGveI5NGeDW/fVEbV4mjdcODsedwiVgoFLrvB4IXP/eVepKGerIr0vNUu2ODAPW29149T9Qav+nMhfz2PATB7ZTMKY8CunVyckvmmlDYIYQ1yuyK6CsrfwPbfUcBxZMIjoTRX5rHE+r4u/jR+/IiJfmaiNeXGEOytyHiJjwTVCwe8goKeBBrnbV74U1gglQ7qyDNu0H9aTjZh7L+2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2017 18:49:03.2927 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 Subject: [PATCH 2/2] OvmfPkg/PlatformPei: DENY_EXECUTE_ON_SECURITY_VIOLATION when SEV is active X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 18:45:42 -0000 Content-Type: text/plain The following commit: 1fea9ddb4e3f OvmfPkg: execute option ROM images regardless of Secure Boot sets the OptionRomImageVerificationPolicy to ALWAYS_EXECUTE the expansion ROMs attached to the emulated PCI devices. A expansion ROM constitute another channel through which a cloud provider (i.e hypervisor) can inject a code in guest boot flow to compromise it. When SEV is enabled, the bios code has been verified by the guest owner via the SEV guest launch sequence before its executed. When secure boot, is enabled, lets make sure that we do not allow guest bios to execute a code which is not signed by the guest owner. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=728 Cc: Chao Zhang Cc: Jordan Justen Cc: Laszlo Ersek Cc: Tom Lendacky Signed-off-by: Brijesh Singh --- OvmfPkg/OvmfPkgIa32X64.dsc | 9 +++++---- OvmfPkg/OvmfPkgX64.dsc | 9 +++++---- OvmfPkg/PlatformPei/PlatformPei.inf | 2 ++ OvmfPkg/PlatformPei/AmdSev.c | 7 +++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 7f9220ccb90a..4bcbddb95768 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -489,10 +489,6 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000 !endif -!if $(SECURE_BOOT_ENABLE) == TRUE - gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 -!endif - # IRQs 5, 9, 10, 11 are level-triggered gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 @@ -552,6 +548,11 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000 !endif +!if $(SECURE_BOOT_ENABLE) == TRUE + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 +!endif + + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform. diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 36c60fc19c40..e52a3bd4db9b 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -488,10 +488,6 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000 !endif -!if $(SECURE_BOOT_ENABLE) == TRUE - gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 -!endif - # IRQs 5, 9, 10, 11 are level-triggered gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 @@ -551,6 +547,11 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout|100000 !endif +!if $(SECURE_BOOT_ENABLE) == TRUE + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 +!endif + + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform. diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 16a8db7b0bd2..de7434d93dc0 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -41,6 +41,7 @@ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + SecurityPkg/SecurityPkg.dec UefiCpuPkg/UefiCpuPkg.dec OvmfPkg/OvmfPkg.dec @@ -96,6 +97,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 26f7c3fdbb13..1539e5b5cdce 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -59,4 +59,11 @@ AmdSevInitialize ( ASSERT_RETURN_ERROR (PcdStatus); DEBUG ((DEBUG_INFO, "SEV is enabled (mask 0x%lx)\n", EncryptionMask)); + + // + // Set Pcd to Deny the execution of option ROM when security + // violation. + // + PcdStatus = PcdSet32S (PcdOptionRomImageVerificationPolicy, 0x4); + ASSERT_RETURN_ERROR (PcdStatus); } -- 2.9.5