From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.92.23.100]) by mx.groups.io with SMTP id smtpd.web10.3071.1590101041045902580 for ; Thu, 21 May 2020 15:44:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=uq6plUTI; spf=pass (domain: outlook.com, ip: 40.92.23.100, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=isRXOWdrbh3WoenmZcfjRI6sBvH83BRNjqqAiMBQDQ2czf35nX2KJCR1A7K34MW5tkBc64HsHWjLZLFA/pO5gVcVi1ztZWr3KRt9+LvsoicYLrSf90AHumxBmYBrId9PRpUe5g3ifP11PVcAeRxnXu24Ah/ICGgQSh8cV5EHiUfVGfCS6uZ7eKyyHHrxUJqUhr/+NjMT/jhSeG5SXWGPSEoihKbdGrrKIRnfQRN2SxkP9gEcrEpq72HxpXUfF7DI62pU3uvdV7KLd2exeZKs6nd7stEjscqKbU0BdewOrl6FAoW6+eNsZAsMaT5uwKbSTxeruKTrEKEvjtRQ+Iak/Q== 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=l0XxYEjb67AA3/kVt2IJztUoeFT7bGsR/jJ233BwCUs=; b=bVkPYqwjTJjYvsKiwQIdjLw2FojqoVCvHpMRcg2iWwTT/pG9a7Tsb+RbUCy45jXNTVcDHbh2iJWvvztOIBRepekmHptPoEphwIvUKEG+Vdf62iBvtvX4c1mcBbqPBqk3oTHCIofQeUMvK5L/AGhGIU7ggSlrQwR0LIpkPe8u17JheFu4yp6coOPdfcO3S8ib1CP4QKU6EtbaPl4RwbG6Y4pe/gv7R/InSJlJMX+1f7bFF7mL4S0su9n0HqrwTwT2Z7x5hjxRAFB6DqFCpbTwFIjahf4Lc7oRqkQJUIg9w0eU5zq6DhMzKG1sVhuEHkr4kThTc34yFkm+5psivgwAnA== 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=l0XxYEjb67AA3/kVt2IJztUoeFT7bGsR/jJ233BwCUs=; b=uq6plUTIgbiDC4owkXPhARi7kp3X9vWIxPFo7XwjroJpjOpgMkXx7l6YTJjGuyyziXb5Y311kyGIRWyJxAiwEBdCSoAWs3D1SVm5jyMg7uxCDkCuI8qCQxXyp7HzzmhROVCt9Pz2VnbDdDJ45tmVMiRijpd57H70Y6dXiIhcCcSElVq1Zhf1nS6PJ+pzLQMMC2mQ5A+DCBUuujYztjMMVr2YFD1DexZ9lPIguBTT+/G8Nl9BGAFOP8cmRh0iekqmQhZRR86S5XIOsZ/ECc4CojqDHgXXpTNUQxGwUGwXQ635PG1QSPiv/FsclsUUasqLwvaXHHVvzY9XQDNlI8I6cA== Received: from MW2NAM12FT062.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::53) by MW2NAM12HT056.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.11; Thu, 21 May 2020 22:43:59 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc65::50) by MW2NAM12FT062.mail.protection.outlook.com (2a01:111:e400:fc65::370) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.11 via Frontend Transport; Thu, 21 May 2020 22:43:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E2210464831C337291D426A2547D01E1E70ED12C58896450B6D3374CB8049116;UpperCasedChecksum:AF433C53298C60AA9C9C7F0BA0AE574D379F5D1377B926493A42CB0F06794369;SizeAsReceived:7971;Count:48 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.3021.020; Thu, 21 May 2020 22:43:59 +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 , Bret Barkelew Subject: [PATCH v3 00/14] Add the VariablePolicy feature Date: Thu, 21 May 2020 15:43:17 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 X-ClientProxiedBy: MWHPR12CA0071.namprd12.prod.outlook.com (2603:10b6:300:103::33) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200521224331.15616-1-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:1:2c94:8481:fffa:8ac5) by MWHPR12CA0071.namprd12.prod.outlook.com (2603:10b6:300:103::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 22:43:57 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200521224331.15616-1-michael.kubacki@outlook.com> X-TMN: [s5twnyHCWjPXFUtI1mYzwFU1iVNoE9sAf1KXOeQBjLDCCVC0VfzocSQpAIKwQn5r] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 62f03c5b-400d-4122-3e9b-08d7fdd872d4 X-MS-TrafficTypeDiagnostic: MW2NAM12HT056: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: el3Iad2aDhaX7cPEQBXpcG17Q6XQbZ311h97NHTwxYhTkR1NAbmSg899OGIYaGpT5nimYlyz2H8YBiudHZ+spfvOtS/neXfB3tLZf1FvbzzaMEAD7AaSK0Zg8HOqUFZbSQ7rGIG9gL7M65Qe7cYdFybfVIV7PEsrkOOxW8fSb5hGYYNwGZ38duHJKz/6RslxjXkbGrr/1TfIQMrFilEEvtZDTdHCyH39PA0q7di/2hg7sUtm6BRsHyyr6cVN7onz 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: IO4wB1Fx/aywe9/YO2ZjatnnpNQMf6HiJVrm8IX5VxjONGgpG7wwNLWiwz/1fbjTKBJfQBQd006DOig+vjWwZ4BgCbqqusOIPfuXQcLvzG5emQzKKx13W1IpgQoyNfmuNggauUtb+6lpELFCG4o1RHSOzP6PwIHodWM1Icvk0rc+sgIQlJKjw5nZ641ak1wbQr46L39j8DUhV6a27t6t/Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62f03c5b-400d-4122-3e9b-08d7fdd872d4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 22:43:59.7268 (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: MW2NAM12HT056 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2522 The 14 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-Protoc= ol---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 Cc: Bret Barkelew Signed-off-by: Michael Kubacki V3 changes: * Address all non-unittest issues with ECC * Make additional style changes * Include section name in hunk headers in "ini-style" files * Remove requirement for the EdkiiPiSmmCommunicationsRegionTable driver (now allocates its own buffer) * Change names from VARIABLE_POLICY_PROTOCOL and gVariablePolicyProtocolGui= d to EDKII_VARIABLE_POLICY_PROTOCOL and gEdkiiVariablePolicyProtocolGuid * Fix GCC warning about initializing externs * Add UNI strings for new PCD * Add patches for ArmVirtPkg, OvmfXen, and UefiPayloadPkg * Reorder patches according to Liming's feedback about adding to platforms before changing variable driver V2 changes: * Fixed implementation for RuntimeDxe * Add PCD to block DisableVariablePolicy * Fix the DumpVariablePolicy pagination in SMM On a separate note, shallow threading might not work on this patch series due to changes made by the SMTP server. I apologize for any inconvenience. Bret Barkelew (14): MdeModulePkg: Define the VariablePolicy protocol interface MdeModulePkg: Define the VariablePolicyLib MdeModulePkg: Define the VariablePolicyHelperLib MdeModulePkg: Define the VarCheckPolicyLib and SMM interface OvmfPkg: Add VariablePolicy engine to OvmfPkg platform EmulatorPkg: Add VariablePolicy engine to EmulatorPkg platform ArmVirtPkg: Add VariablePolicy engine to ArmVirtPkg platform UefiPayloadPkg: Add VariablePolicy engine to UefiPayloadPkg platform 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 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c = | 324 +++ MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c = | 404 ++++ MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c = | 46 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c= | 86 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c = | 830 +++++++ MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePoli= cyUnitTest.c | 2533 ++++++++++++++++++++ MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTe= stApp.c | 1950 +++++++++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c = | 56 +- MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c = | 64 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c = | 49 +- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c = | 53 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLockRequestToLock.c = | 73 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c = | 649 +++++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c = | 14 + SecurityPkg/Library/AuthVariableLib/AuthService.c = | 24 +- ArmVirtPkg/ArmVirt.dsc.inc = | 7 + 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 = | 42 + MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.uni = | 12 + MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf = | 35 + MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.uni = | 12 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf = | 44 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.uni = | 12 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf = | 51 + MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePoli= cyUnitTest.inf | 40 + MdeModulePkg/MdeModulePkg.ci.yaml = | 4 +- MdeModulePkg/MdeModulePkg.dec = | 26 +- MdeModulePkg/MdeModulePkg.dsc = | 15 + MdeModulePkg/MdeModulePkg.uni = | 7 + MdeModulePkg/Test/MdeModulePkgHostTest.dsc = | 11 + MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/Readme.md = | 55 + MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/VariablePolicyFuncTe= stApp.inf | 42 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf = | 5 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf = | 4 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf = | 11 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf = | 4 + OvmfPkg/OvmfPkgIa32.dsc = | 8 + OvmfPkg/OvmfPkgIa32X64.dsc = | 8 + OvmfPkg/OvmfPkgX64.dsc = | 8 + OvmfPkg/OvmfXen.dsc = | 7 + SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf = | 2 + UefiPayloadPkg/UefiPayloadPkgIa32.dsc = | 7 + UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc = | 7 + 47 files changed, 8151 insertions(+), 78 deletions(-) create mode 100644 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLi= b.c create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePo= licyHelperLib.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyEx= traInitNull.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyEx= traInitRuntimeDxe.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= b.c create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUn= itTest/VariablePolicyUnitTest.c create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/V= ariablePolicyFuncTestApp.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLock= RequestToLock.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePoli= cySmmDxe.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/VarCheckPolicyLi= b.inf create mode 100644 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLi= b.uni create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePo= licyHelperLib.inf create mode 100644 MdeModulePkg/Library/VariablePolicyHelperLib/VariablePo= licyHelperLib.uni create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= b.inf create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= b.uni create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= bRuntimeDxe.inf create mode 100644 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUn= itTest/VariablePolicyUnitTest.inf create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/R= eadme.md create mode 100644 MdeModulePkg/Test/ShellTest/VariablePolicyFuncTestApp/V= ariablePolicyFuncTestApp.inf --=20 2.16.3.windows.1