From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.92.40.87]) by mx.groups.io with SMTP id smtpd.web10.1157.1589266022845993019 for ; Mon, 11 May 2020 23:47:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=AavE+/57; spf=pass (domain: outlook.com, ip: 40.92.40.87, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c5EvXTrr5BpE3p3v8g1elN8q69VzoEeNnqjgF6dAzxvbQFLhQBrSyTTzucnTH1WZDh1N3mOx6jM/sFMgmJRDsbNT6CBgXLKNLx0qMIBfwB8BkuMPciOe4GGj8lqUI9jpLYpvxAYwXEIcQYjw9/cUe3diGama92RYiALyx99aY7UAXqmNQo3n/SIj244pH2CErftR792ZszMaeWt4bMXo4pEyQLqK9uap3aDTSIV/xo+GW0iD3cvUwxVmjp7gFktSEv1Lic2Ez/6kIyt3aqyOVyo0M6Ez3b2o+rGg8Q8PW49aJbZHpVtYhBluH9CBZ1wnhWZSZVI61kIBeCZRz7T03w== 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-SenderADCheck; bh=CRY7MljBZkLxsMtxk2EoPNH8gvAbcr/Gg+atGB2HcLQ=; b=Wa1E4JnCt5lSkaV5GNdmOZ6fN8SmKCX3eNwfERJRifGtjqzmK+giFdPvYuE++LgyTkReiBE0CJqv73GkG+gzRxpGg2rcCtuNvOyQLfVH5j1txkQ4hX2nd7Sb/A8oYjPjn/o3mWwWxIXuVrPNZOyfOp38NREexMnA1QKYEUfQLAjC78VwyqW0BP+bXbEI6GsJqv8xSgmDtSZueqdAw/9L7R3wd/tftj2qKsiZcx8PpTMAglWRS/GzZ+DBIYXZxSRvuPcvRufxa3rwj/V9R1y/O54xa2L15saeyCrz4pJQTkG6l+CgxE164ONPZ/dUmMWNYZ30dSDJttOGcw7mYsLF/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CRY7MljBZkLxsMtxk2EoPNH8gvAbcr/Gg+atGB2HcLQ=; b=AavE+/57lkeXkDcYPMBKEtNCdv0+6TCUxpmBCLD6UwgDu+eF+VFS3OaJjOC/n92trHsJ2In4Q6nxeHuIS9QEHQl0wZhameDs5woyReozXx5x5ovwGd1Z1c87qs1XiF04cfyGoxv9U2elt8Srm96+SG2+HOiiAAtKJSaIiFLZsudvokYT8lN/kzN0sF/N2Gbh3uay8zovbhazXqrl2pGZxf0RyCoSlRK7C1lDcHr35eJh55GG7iQu2NOdOTHz3uzUUN9LMznsGFZ5rNhWBKMqqjTakfCEmO8LCtg7NUdDIIPknUb9pkzusAxkkafDk26BbpwnuXdBtkd9BsN1BMp0TQ== Received: from BN7NAM10FT010.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::42) by BN7NAM10HT212.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Tue, 12 May 2020 06:47:01 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e8f::4b) by BN7NAM10FT010.mail.protection.outlook.com (2a01:111:e400:7e8f::421) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Tue, 12 May 2020 06:47:01 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2233F7EF0F5BE3D4912CCDEAE87BE794C237FF37D81248FBD30430448D48929C;UpperCasedChecksum:4AF2BD4BD7E4BA9D3446D83F93B38CBB699D551F7979305CB102825103BBC9A3;SizeAsReceived:7867;Count:47 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3%6]) with mapi id 15.20.2979.033; Tue, 12 May 2020 06:47:01 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Jian J Wang , Hao A Wu , Liming Gao , Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Andrew Fish , Ray Ni Subject: [PATCH v2 00/12] Add the VariablePolicy feature Date: Mon, 11 May 2020 23:46:23 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 X-ClientProxiedBy: MW2PR16CA0022.namprd16.prod.outlook.com (2603:10b6:907::35) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200512064635.14640-1-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:b:422:2743:5e95:81bb) by MW2PR16CA0022.namprd16.prod.outlook.com (2603:10b6:907::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Tue, 12 May 2020 06:47:00 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200512064635.14640-1-michael.kubacki@outlook.com> X-TMN: [oNxNqUZfZUTjStpQfp8F+A3QDEk/zwp3rBFPp57HeiRuUg5o3N1Njhsf5nuDJM8t] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4d19c482-a1ee-4852-01f8-08d7f64045c2 X-MS-TrafficTypeDiagnostic: BN7NAM10HT212: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eESOIXNgvBxZ5pN6du6FjVImbL1T9Rogr/BF3YH2U9GKoBWmfDMAvyKOU7xKxFjIoK6hsUvB0dNjEHM/vG5zTnUnn4gTvd+yZuWhqe6Ts7Jgz37/gNNScglvEZthplsLDYWz4m8GF++bN8XsaWFrSyPpBksGjOFNcSViBjBzHImgzAsJ3L6m7//NK5yd1HiPLP14C94ZDIfpM0JRlidATkVjcRQjtFCz39G+g9xPW6a96EYNphCRGWXkAWiFTN2O X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR07MB3440.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: e/oBSiqHQvkrfVWDkT9DU/XU/Au2SHUiwtFnf3JPIsVihOd1n++t8zSjL1nCrG1VuoRJDt0nZ5BDeZOIkjQUCW1z1uicDTzscl0rp8G3lvAhrxvkVxISDIk4/D9NBP02xmBX13OTYiP6+FwS3iXG1206o1S9G9rqmDmnLoqt33srWzFu8vG6LGej/9WEDqJKp0PyHJKp+BjOcav0+GcOzA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d19c482-a1ee-4852-01f8-08d7f64045c2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2020 06:47:01.0153 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7NAM10HT212 Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2522 The 12 patches in this series add the VariablePolicy feature to the core, deprecate Edk2VarLock (while adding a compatibility layer to reduce code churn), and integrate the VariablePolicy libraries and protocols into Variable Services. Since the integration requires multiple changes, including adding libraries, a protocol, an SMI communication handler, and VariableServices integration, the patches are broken up by individual library additions and then a final integration. Security-sensitive changes like bypassing Authenticated Variable enforcement are also broken out into individual patches so that attention can be called directly to them. Platform porting instructions are described in this wiki entry: https://github.com/tianocore/tianocore.github.io/wiki/VariablePolicy-Protocol---Enhanced-Method-for-Managing-Variables#platform-porting Discussion of the feature can be found in multiple places throughout the last year on the RFC channel, staging branches, and in devel. Most recently, this subject was discussed in this thread: https://edk2.groups.io/g/devel/message/53712 (the code branches shared in that discussion are now out of date, but the whitepapers and discussion are relevant). Cc: Jiewen Yao Cc: Chao Zhang Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Michael Kubacki Changes since v1: * Fixed implementation for RuntimeDxe * Add PCD to block DisableVariablePolicy * Fix the DumpVariablePolicy pagination in SMM Bret Barkelew (12): MdeModulePkg: Define the VariablePolicy protocol interface MdeModulePkg: Define the VariablePolicyLib MdeModulePkg: Define the VariablePolicyHelperLib MdeModulePkg: Define the VarCheckPolicyLib and SMM interface MdeModulePkg: Connect VariablePolicy business logic to VariableServices MdeModulePkg: Allow VariablePolicy state to delete protected variables SecurityPkg: Allow VariablePolicy state to delete authenticated variables MdeModulePkg: Change TCG MOR variables to use VariablePolicy MdeModulePkg: Drop VarLock from RuntimeDxe variable driver MdeModulePkg: Add a shell-based functional test for VariablePolicy OvmfPkg: Add VariablePolicy engine to OvmfPkg platform EmulatorPkg: Add VariablePolicy engine to EmulatorPkg platform MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c | 318 +++ MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c | 396 ++++ MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c | 46 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c | 85 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c | 806 +++++++ MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c | 2285 ++++++++++++++++++++ MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTestApp.c | 1942 +++++++++++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c | 52 +- MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c | 60 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c | 49 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 53 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLockRequstToLock.c | 71 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c | 653 ++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 14 + SecurityPkg/Library/AuthVariableLib/AuthService.c | 22 +- EmulatorPkg/EmulatorPkg.dsc | 6 + MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h | 54 + MdeModulePkg/Include/Library/VariablePolicyHelperLib.h | 164 ++ MdeModulePkg/Include/Library/VariablePolicyLib.h | 207 ++ MdeModulePkg/Include/Protocol/VariablePolicy.h | 157 ++ MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf | 44 + MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.uni | 12 + MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf | 36 + MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.uni | 12 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf | 44 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.uni | 12 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf | 52 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.inf | 41 + MdeModulePkg/MdeModulePkg.ci.yaml | 4 +- MdeModulePkg/MdeModulePkg.dec | 26 +- MdeModulePkg/MdeModulePkg.dsc | 15 + MdeModulePkg/Test/MdeModulePkgHostTest.dsc | 11 + MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/Readme.md | 55 + MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTestApp.inf | 42 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf | 5 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf | 4 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 12 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 4 + OvmfPkg/OvmfPkgIa32.dsc | 8 + OvmfPkg/OvmfPkgIa32X64.dsc | 8 + OvmfPkg/OvmfPkgX64.dsc | 8 + SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 2 + 42 files changed, 7819 insertions(+), 78 deletions(-) create mode 100644 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTestApp.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLockRequstToLock.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c create mode 100644 MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h create mode 100644 MdeModulePkg/Include/Library/VariablePolicyHelperLib.h create mode 100644 MdeModulePkg/Include/Library/VariablePolicyLib.h create mode 100644 MdeModulePkg/Include/Protocol/VariablePolicy.h create mode 100644 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.inf create mode 100644 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.uni create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.uni create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.uni create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.inf create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/Readme.md create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTestApp.inf -- 2.16.3.windows.1