This is a rogue SMM driver. It runs in SMM mode and has access to
confidential SMM data. It saves the address of the SMST for the next
patch, in runtime storage pointed-to by the PCD added in the previous
patch, and exits.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf | 51 +++++++++++++++++++++++++++++
 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c   | 38 +++++++++++++++++++++
 OvmfPkg/OvmfPkgX64.dsc                      |  2 ++
 OvmfPkg/OvmfPkgX64.fdf                      |  1 +
 4 files changed, 92 insertions(+)
 create mode 100644 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf
 create mode 100644 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c

diff --git a/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf 
b/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf
new file mode 100644
index 0000000..5ff895d
--- /dev/null
+++ b/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf
@@ -0,0 +1,51 @@
+## @file
+# An SMM driver that publishes the address of the SMST.
+#
+# Copyright (C) 2013, Red Hat, Inc.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = DiscloseSmstSmm
+  FILE_GUID                      = 2AD83D53-687B-4C3A-8840-EE71164195EB
+  MODULE_TYPE                    = DXE_SMM_DRIVER
+  VERSION_STRING                 = 1.0
+  PI_SPECIFICATION_VERSION       = 0x0001000A
+  ENTRY_POINT                    = DiscloseSmstSmmEntryPoint
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  DiscloseSmstSmm.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  PcdLib
+  SmmServicesTableLib
+  UefiDriverEntryPoint
+
+[Pcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdDiscloseSmstPtrPtr
+
+[Guids]
+
+[Protocols]
+
+[Depex]
+  TRUE
diff --git a/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c 
b/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c
new file mode 100644
index 0000000..152ff98
--- /dev/null
+++ b/OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c
@@ -0,0 +1,38 @@
+/** @file
+  An SMM driver that publishes the address of the SMST.
+
+  Copyright (C) 2013, Red Hat, Inc.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/SmmServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+DiscloseSmstSmmEntryPoint (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  UINT64 *DiscloseSmstPtrPtr;
+
+  DiscloseSmstPtrPtr = (UINT64 *)(UINTN) PcdGet64 (PcdDiscloseSmstPtrPtr);
+  ASSERT (DiscloseSmstPtrPtr != NULL);
+
+  *DiscloseSmstPtrPtr = (UINT64)(UINTN) gSmst;
+
+  //
+  // No need to keep this in memory after setting the PCD.
+  //
+  return EFI_ABORTED;
+}
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index f9ea4c7..d12faee 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -278,10 +278,11 @@
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
 !else
   DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
 !endif
   LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
 
 
################################################################################
 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform.
 #
@@ -517,10 +518,11 @@
   #
   OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
   MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
   MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
   MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
+  OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 9e2da17..f7b903a 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -365,10 +365,11 @@ INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
 INF  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
+INF  OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
 INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
 INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
-- 
1.8.3.1



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to