2010-02-24 00:58:38 +01:00
|
|
|
## @file
|
2009-05-27 23:10:18 +02:00
|
|
|
# SEC Driver
|
|
|
|
#
|
2015-10-16 18:48:24 +02:00
|
|
|
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
2009-05-27 23:10:18 +02:00
|
|
|
#
|
2010-04-28 14:43:04 +02:00
|
|
|
# This program and the accompanying materials
|
2009-05-27 23:10:18 +02:00
|
|
|
# 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.
|
|
|
|
#
|
2010-02-24 00:58:38 +01:00
|
|
|
##
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
[Defines]
|
|
|
|
INF_VERSION = 0x00010005
|
|
|
|
BASE_NAME = SecMain
|
|
|
|
FILE_GUID = df1ccef6-f301-4a63-9661-fc6030dcc880
|
|
|
|
MODULE_TYPE = SEC
|
|
|
|
VERSION_STRING = 1.0
|
|
|
|
ENTRY_POINT = SecMain
|
|
|
|
|
|
|
|
#
|
|
|
|
# The following information is for reference only and not required by the build tools.
|
|
|
|
#
|
|
|
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
|
|
|
#
|
|
|
|
|
2010-02-24 00:58:38 +01:00
|
|
|
[Sources]
|
2009-05-27 23:10:18 +02:00
|
|
|
SecMain.c
|
|
|
|
|
|
|
|
[Sources.IA32]
|
2014-10-31 21:55:06 +01:00
|
|
|
Ia32/SecEntry.nasm
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
[Sources.X64]
|
2014-10-31 21:55:16 +01:00
|
|
|
X64/SecEntry.nasm
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
[Packages]
|
|
|
|
MdePkg/MdePkg.dec
|
2010-08-03 09:41:54 +02:00
|
|
|
MdeModulePkg/MdeModulePkg.dec
|
2009-11-25 05:26:09 +01:00
|
|
|
UefiCpuPkg/UefiCpuPkg.dec
|
2009-05-27 23:10:18 +02:00
|
|
|
OvmfPkg/OvmfPkg.dec
|
|
|
|
|
|
|
|
[LibraryClasses]
|
|
|
|
BaseLib
|
2010-08-03 09:41:54 +02:00
|
|
|
DebugLib
|
2010-01-04 17:17:59 +01:00
|
|
|
BaseMemoryLib
|
2010-08-03 09:41:54 +02:00
|
|
|
PeiServicesLib
|
2009-11-25 05:26:09 +01:00
|
|
|
PcdLib
|
2009-12-17 00:29:17 +01:00
|
|
|
UefiCpuLib
|
2010-08-03 09:41:54 +02:00
|
|
|
DebugAgentLib
|
|
|
|
IoLib
|
|
|
|
PeCoffLib
|
|
|
|
PeCoffGetEntryPointLib
|
|
|
|
PeCoffExtraActionLib
|
|
|
|
ExtractGuidedSectionLib
|
2015-10-16 18:48:24 +02:00
|
|
|
LocalApicLib
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
[Ppis]
|
|
|
|
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED
|
|
|
|
|
2010-01-30 01:10:44 +01:00
|
|
|
[Pcd]
|
2014-01-21 20:39:13 +01:00
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
|
2014-01-21 20:38:34 +01:00
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase
|
2014-01-21 20:38:43 +01:00
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
|
2015-11-30 19:41:14 +01:00
|
|
|
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
|
OvmfPkg: Sec: assert the build-time calculated end of the scratch buffer
The DecompressMemFvs() function in "OvmfPkg/Sec/SecMain.c" uses more
memory, temporarily, than what PEIFV and DXEFV will ultimately need.
First, it uses an output buffer for decompression, second, the
decompression itself needs a scratch buffer (and this scratch buffer is
the highest area that SEC uses).
DecompressMemFvs() used to be called on normal boots only (ie. not on S3
resume), which is why the decompression output buffer and the scratch
buffer were allowed to scribble over RAM. However, we'll soon start to
worry during S3 resume that the runtime OS might tamper with the
pre-decompressed PEIFV, and we'll decompress the firmware volumes on S3
resume too, from pristine flash. For this we'll need to know the end of
the scratch buffer in advance, so we can prepare a non-malicious OS for
it.
Calculate the end of the scratch buffer statically in the FDF files, and
assert in DecompressMemFvs() that the runtime decompression will match it.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19036 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-30 19:41:20 +01:00
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd
|
2017-11-08 19:43:21 +01:00
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
|
OvmfPkg: decompress FVs on S3 resume if SMM_REQUIRE is set
If OVMF was built with -D SMM_REQUIRE, that implies that the runtime OS is
not trusted and we should defend against it tampering with the firmware's
data.
One such datum is the PEI firmware volume (PEIFV). Normally PEIFV is
decompressed on the first boot by SEC, then the OS preserves it across S3
suspend-resume cycles; at S3 resume SEC just reuses the originally
decompressed PEIFV.
However, if we don't trust the OS, then SEC must decompress PEIFV from the
pristine flash every time, lest we execute OS-injected code or work with
OS-injected data.
Due to how FVMAIN_COMPACT is organized, we can't decompress just PEIFV;
the decompression brings DXEFV with itself, plus it uses a temporary
output buffer and a scratch buffer too, which even reach above the end of
the finally installed DXEFV. For this reason we must keep away a
non-malicious OS from DXEFV too, plus the memory up to
PcdOvmfDecomprScratchEnd.
The delay introduced by the LZMA decompression on S3 resume is negligible.
If -D SMM_REQUIRE is not specified, then PcdSmmSmramRequire remains FALSE
(from the DEC file), and then this patch has no effect (not counting some
changed debug messages).
If QEMU doesn't support S3 (or the user disabled it on the QEMU command
line), then this patch has no effect also.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19037 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-30 19:41:24 +01:00
|
|
|
|
|
|
|
[FeaturePcd]
|
|
|
|
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
|