audk/MdeModulePkg/Universal
Laszlo Ersek fda8f631ed MdeModulePkg/Variable/RuntimeDxe: delete and lock OS-created MOR variable
According to the TCG Platform Reset Attack Mitigation Specification (May
15, 2008):

> 5 Interface for UEFI
> 5.1 UEFI Variable
> 5.1.1 The MemoryOverwriteRequestControl
>
> Start of informative comment:
>
> [...] The OS loader should not create the variable. Rather, the firmware
> is required to create it and must support the semantics described here.
>
> End of informative comment.

However, some OS kernels create the MOR variable even if the platform
firmware does not support it (see one Bugzilla reference below). This OS
issue breaks the logic added in the last patch.

Strengthen the MOR check by searching for the TCG or TCG2 protocols, as
edk2's implementation of MOR depends on (one of) those protocols.

The protocols are defined under MdePkg, thus there's no inter-package
dependency issue. In addition, calling UEFI services in
MorLockInitAtEndOfDxe() is safe, due to the following order of events /
actions:

- platform BDS signals the EndOfDxe event group,
- the SMM core installs the SmmEndOfDxe protocol,
- MorLockInitAtEndOfDxe() is invoked, and it calls UEFI services,
- some time later, platform BDS installs the DxeSmmReadyToLock protocol,
- SMM / SMRAM is locked down and UEFI services become unavailable to SMM
  drivers.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ladi Prosek <lprosek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1498159
Suggested-by: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Tested-by: Ladi Prosek <lprosek@redhat.com>
2017-10-10 11:25:28 +02:00
..
Acpi MdeModulePkg/S3SaveState: Extract arguments in correct order 2017-10-10 13:23:10 +08:00
BdsDxe MdeModulePkg/BdsDxe: Don't delete "BootNext" until booting it 2017-09-29 15:23:15 +08:00
BootManagerPolicyDxe
CapsulePei MdeModulePkg: Error Level is not used correctly 2017-04-12 08:56:12 +08:00
CapsuleRuntimeDxe MdeModulePkg: Error Level is not used correctly 2017-04-12 08:56:12 +08:00
Console MdeModulePkg: Update comments in SimpleTextInEx according to UEFI 2.7 2017-06-20 09:29:42 +08:00
DebugPortDxe MdeModulePkg: Refine type cast for pointer subtraction 2017-03-06 14:14:09 +08:00
DebugSupportDxe MdeModulePkg/DebugSupportDxe: Fix XCODE5 build failure 2017-05-24 16:44:21 -07:00
DevicePathDxe
Disk MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference 2017-09-27 19:09:25 +08:00
DisplayEngineDxe MdeModulePkg/DisplayEngine: Add implementation of HiiPopup protocol 2017-08-23 10:37:14 +08:00
DriverHealthManagerDxe
DriverSampleDxe MdeModulePkg/DriverSample: Add sample case for popup protocol 2017-08-23 10:37:14 +08:00
EbcDxe MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
EsrtDxe MdeModulePkg/Esrt: Add ESRT_FW_TYPE_SYSTEMFIRMWARE check. 2016-11-08 22:37:03 +08:00
FaultTolerantWriteDxe MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
FaultTolerantWritePei
FileExplorerDxe MdeModulePkg FileExplorerDxe: Change file format which has mixed file format. 2015-12-16 03:22:39 +00:00
FvSimpleFileSystemDxe MdeModulePkg/FvSimpleFileSystem: fix assertions when FV is empty 2016-08-03 09:48:18 +08:00
HiiDatabaseDxe MdeModulePkg/HiiDatabase: Handle questions with Bit VarStore 2017-09-21 16:17:42 +08:00
HiiResourcesSampleDxe
LegacyRegion2Dxe
LoadFileOnFv2 MdeModulePkg LoadFileOnFv2: Correct the parameter name in function comment 2016-10-25 11:53:59 +08:00
LockBox/SmmLockBox MdeModulePkg: Error Level is not used correctly 2017-04-12 08:56:12 +08:00
MemoryTest MdeModulePkg/Universal: Fix typos in comments 2016-10-27 09:11:19 +08:00
Metronome
MonotonicCounterRuntimeDxe MdeModulePkg: Minor comments update to GetNextHighMonotonicCount() 2016-01-29 09:26:49 +00:00
Network MdeModulePkg: Fix GCC build error. 2017-09-06 18:07:40 +08:00
PCD MdeModulePkg PCD: Fix TmpTokenSpaceBufferCount not assigned correctly 2017-05-19 11:32:11 +08:00
PcatSingleSegmentPciCfg2Pei
PlatformDriOverrideDxe MdeModulePkg: Error Level is not used correctly 2017-04-12 08:56:12 +08:00
PrintDxe MdeModulePkg/PrintDxe: Handle the deprecation of [A|U]ValueToString 2017-03-02 09:59:06 +08:00
PropertiesTableAttributesDxe
RegularExpressionDxe MdeModulePkg: Delete useless case code 2017-08-16 16:55:22 +08:00
ReportStatusCodeRouter
ResetSystemRuntimeDxe MdeModulePkg ResetSystem: Update the comments of ResetSystem() 2017-07-03 17:53:12 +08:00
SectionExtractionDxe
SectionExtractionPei
SecurityStubDxe MdeModulePkg/SecurityStubDxe: Report failure if image is load earlier 2016-11-10 15:58:00 +08:00
SerialDxe MdeModulePkg/SerialDxe: Fix not able to change serial attributes 2017-09-19 11:02:56 +08:00
SetupBrowserDxe MdeModulePkg/SetupBrowser:Add NULL check before using a pointer 2017-09-22 14:58:41 +08:00
SmbiosDxe MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
SmbiosMeasurementDxe MdeModulePkg SmbiosMeasurementDxe: Skip measurement for OEM type 2017-09-18 10:19:40 +08:00
SmmCommunicationBufferDxe MdeModulePkg: Add new driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE. 2016-04-29 12:49:09 +08:00
StatusCodeHandler MdeModulePkg/MemoryStatusCode: Expose the DXE memory status code table. 2016-06-29 09:46:51 +08:00
TimestampDxe
Variable MdeModulePkg/Variable/RuntimeDxe: delete and lock OS-created MOR variable 2017-10-10 11:25:28 +02:00
WatchdogTimerDxe MdeModulePkg/Universal: Fix typos in comments 2016-10-27 09:11:19 +08:00