audk/SecurityPkg/Library
Laszlo Ersek 8b0932c19f SecurityPkg/DxeImageVerificationHandler: fix "defer" vs. "deny" policies
In DxeImageVerificationHandler(), we should return EFI_SECURITY_VIOLATION
for a rejected image only if the platform sets
DEFER_EXECUTE_ON_SECURITY_VIOLATION as the policy for the image's source.
Otherwise, EFI_ACCESS_DENIED must be returned.

Right now, EFI_SECURITY_VIOLATION is returned for all rejected images,
which is wrong -- it causes LoadImage() to hold on to rejected images (in
untrusted state), for further platform actions. However, if a platform
already set DENY_EXECUTE_ON_SECURITY_VIOLATION, the platform will not
expect the rejected image to stick around in memory (regardless of its
untrusted state).

Therefore, adhere to the platform policy in the return value of the
DxeImageVerificationHandler() function.

Furthermore, according to "32.4.2 Image Execution Information Table" in
the UEFI v2.8 spec, and considering that edk2 only supports (AuditMode==0)
at the moment:

> When AuditMode==0, if the image's signature is not found in the
> authorized database, or is found in the forbidden database, the image
> will not be started and instead, information about it will be placed in
> this table.

we have to store an EFI_IMAGE_EXECUTION_INFO record in both the "defer"
case and the "deny" case. Thus, the AddImageExeInfo() call is not being
made conditional on (Policy == DEFER_EXECUTE_ON_SECURITY_VIOLATION); the
documentation is updated instead.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2129
Fixes: 5db28a6753
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200116190705.18816-12-lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
[lersek@redhat.com: push with Mike's R-b due to Chinese New Year
 Holiday: <https://edk2.groups.io/g/devel/message/53429>; msgid
 <d3fbb76dabed4e1987c512c328c82810@intel.com>]
2020-01-31 09:35:31 +00:00
..
AuthVariableLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
DxeImageAuthenticationStatusLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
DxeImageVerificationLib SecurityPkg/DxeImageVerificationHandler: fix "defer" vs. "deny" policies 2020-01-31 09:35:31 +00:00
DxeRsa2048Sha256GuidedSectionExtractLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
DxeTcg2PhysicalPresenceLib SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
DxeTcgPhysicalPresenceLib SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
DxeTpm2MeasureBootLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
DxeTpmMeasureBootLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
DxeTpmMeasurementLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
FmpAuthenticationLibPkcs7 SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
FmpAuthenticationLibRsa2048Sha256 SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
HashInstanceLibSha1 SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
HashInstanceLibSha256 SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
HashInstanceLibSha384 SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
HashInstanceLibSha512 SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
HashInstanceLibSm3 SecurityPkg: introduce the SM3 digest algorithm 2019-07-19 14:31:52 +02:00
HashLibBaseCryptoRouter SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm 2019-07-19 14:31:55 +02:00
HashLibTpm2 SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
PeiRsa2048Sha256GuidedSectionExtractLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
PeiTcg2PhysicalPresenceLib SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
PlatformSecureLibNull SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
SmmTcg2PhysicalPresenceLib SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
Tcg2PpVendorLibNull SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
TcgPpVendorLibNull SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
TcgStorageCoreLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
TcgStorageOpalLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
Tpm2CommandLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
Tpm2DeviceLibDTpm SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
Tpm2DeviceLibRouter SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
Tpm2DeviceLibTcg2 SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
Tpm12CommandLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
Tpm12DeviceLibDTpm SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00
Tpm12DeviceLibTcg SecurityPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:23 -07:00
TpmCommLib SecurityPkg: Fix spelling errors 2019-10-23 10:23:23 -07:00