From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=104.47.41.79; helo=nam03-dm3-obe.outbound.protection.outlook.com; envelope-from=brijesh.singh@amd.com; receiver=edk2-devel@lists.01.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0079.outbound.protection.outlook.com [104.47.41.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1BC7B21E1B751 for ; Thu, 5 Oct 2017 13:13:34 -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=b9zMNO/jCjJpmB1LR2puCpiFgtWll8kUtpAku7Ts0lo=; b=ARSDDgdl2fsaMQprGVUJLygkqQE8sbvDSodEcSv0sQg4vCXYxoOm3OckFYaaXyQz6RcDwBId/IeB5N43iYgc2YaouHgnp6Z7xboERMTlRa1ifU3Y4EwJPROhxd8K8DUhqt1XBJre/GbUkCAmHIbig3k8qWzR3U2peAAVk0Sg4yY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) 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 20:16:54 +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 15:16:42 -0500 Message-Id: <20171005201642.122619-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171005201642.122619-1-brijesh.singh@amd.com> References: <20171005201642.122619-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR21CA0065.namprd21.prod.outlook.com (10.172.93.155) To CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a216d487-fcd9-4d62-561d-08d50c2e060f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0150; 3:wCs53UWlP2sXy8kWZZh+bAKg7MmgZJeLnie6KSPf6Gap3DbUGLKsTNIjjaiwJlNs0owjH9t8vr41rOmU/93ogdA9a7zaXrTHEjWjlJ7FLHf11oMVYDyve/DFG74d0yBJVtd52QEUGrSZ5trChgSs8KCcZY2ZpJzUKU2MLOrqmCepaB3ESeGrzNgB81TdbVHVwtzWY7pmlLlW0zY+EX6EEyyNkJcEFtztJnSbyLuiqiVfAZXgt08M0ovOe3ySz3k1; 25:bj+xEXaBpYwk4JEtfvwE8P37UrlD9UvA2SwE7KIWq9PmK0S78r25iBIp+YN98HrNIz5LLJRi6WHJ+hLGTQVAr3pCMNGYlL3Mc62QJJz9GOvWQo36JWxZ2JHc+Pwdw6W2yPEK1l8OElMQurHKTMqMXfRDbN9gUGbBwWVl1BUL7+9T4XLTFSDQbJyGcBiNv/TwfiS3GznxiFDCwFU4UpC29LmJAqe8ai/oYN3nsuBc5sZBQ20bwJUevDTO1QdLzc++Lur2mWclNqhmcxWaw3Dc7KkDmqMdXzCl81Bk2GXdGLqZRatQQMM2EbQHZdMexUXcwRVsrPZEA2TR0vnJ8ksTCg==; 31:xwqS+dgCGl2nxD+v5wBMdIHVrg0fyfidW2zPPZS9B394omsWwp9XdEvBq4jj2s2ipIVnWqdsU6JVK9DB81gaxkQlyJC1IbyFvAxXCJAmZ/05HTd/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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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR12MB0150; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR12MB0150; X-Forefront-PRVS: 04519BA941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(199003)(189002)(97736004)(81156014)(50226002)(6666003)(86362001)(76176999)(575784001)(106356001)(105586002)(3846002)(6116002)(33646002)(7736002)(50986999)(5890100001)(8936002)(189998001)(81166006)(2950100002)(6916009)(68736007)(8676002)(101416001)(966005)(1076002)(305945005)(53936002)(5003940100001)(48376002)(50466002)(2906002)(316002)(66066001)(2361001)(53416004)(54906003)(47776003)(5660300001)(16586007)(36756003)(4326008)(6486002)(6306002)(16526018)(478600001)(2351001)(25786009)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0150; 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; CY1PR12MB0150; 23:ZFwKF7oAOAlVJ964i3hKBMOiGwKptHErWhZaeo9KI?= =?us-ascii?Q?7lKeJfcDTWy7NGsKJ+qM9AOrjBlST2XeO3a7sC9CKQIhYIvAll8q6Qr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vnDtN/+jrmi67RlrosT6rog1a3mTmNOaG1y/HuFU15N5ymL/vttnAlzRxNYvvGREUdYDS3gR8XhyebdNoMC4JIUmvPaBMopMx/ltS4fHdTfwqM6j48wVoD7pNGLTrv/1yDd2p8fE5NTz/grhV4zjL9uho1OXCTBFcnVw47iPnF9LmHOatUqn3XRPU43AzG538JQhwYYj80T4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0150; 20:czeJA7lTz1j6poNf15xlswyt5G+EHLzFYIKEXfTnbkpDsBsQxocpGajgNJfUxpje9sqX3vF41CGjDey+rt6g5+1Yg2DWixHMG1f/3c2fRWlmeNgNBlg1TZBK9vi3Pa0mEoSoa/nHeWlrgga/bY7MZx9xgj9Y8Uy2YE66MpVq6Z0HJryfIDg/ItuJfpEX/oXDMMS7a6kOpfqTOEjFT8ekTJGNpYc5o50DCvrPTJ+lx4Bailn8C9Kws66N32QCvvsC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2017 20:16:54.5146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0150 Subject: [PATCH v2 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 20:13:34 -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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- Changes since v1: * Add Contributed-under tag * Fix OvmfPkgIa32.dsc build OvmfPkg/OvmfPkgIa32.dsc | 9 +++++---- OvmfPkg/OvmfPkgIa32X64.dsc | 9 +++++---- OvmfPkg/OvmfPkgX64.dsc | 9 +++++---- OvmfPkg/PlatformPei/PlatformPei.inf | 2 ++ OvmfPkg/PlatformPei/AmdSev.c | 7 +++++++ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 92e943d4a0d0..7fb557b7c9cd 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -483,10 +483,6 @@ [PcdsFixedAtBuild] gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000 !endif -!if $(SECURE_BOOT_ENABLE) == TRUE - gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 -!endif - # IRQs 5, 9, 10, 11 are level-triggered gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 @@ -544,6 +540,11 @@ [PcdsDynamicDefault] 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/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 7f9220ccb90a..4bcbddb95768 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -489,10 +489,6 @@ [PcdsFixedAtBuild.X64] 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 @@ [PcdsDynamicDefault] 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 @@ [PcdsFixedAtBuild] 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 @@ [PcdsDynamicDefault] 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 @@ [Packages] IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + SecurityPkg/SecurityPkg.dec UefiCpuPkg/UefiCpuPkg.dec OvmfPkg/OvmfPkg.dec @@ -96,6 +97,7 @@ [Pcd] 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