audk/ArmVirtPkg/Library
Laszlo Ersek ae9f12058d ArmVirtPkg/PlatformBootManagerLib: unload image on EFI_SECURITY_VIOLATION
The LoadImage() boot service is a bit unusual in that it allocates
resources in a particular failure case; namely, it produces a valid
"ImageHandle" when it returns EFI_SECURITY_VIOLATION. This is supposed to
happen e.g. when Secure Boot verification fails for the image, but the
platform policy for the particular image origin (such as "fixed media" or
"removable media") is DEFER_EXECUTE_ON_SECURITY_VIOLATION. The return code
allows platform logic to selectively override the verification failure,
and launch the image nonetheless.

ArmVirtPkg/PlatformBootManagerLib does not override EFI_SECURITY_VIOLATION
for the kernel image loaded from fw_cfg -- any LoadImage() error is
considered fatal. When we simply treat EFI_SECURITY_VIOLATION like any
other LoadImage() error, we leak the resources associated with
"KernelImageHandle". From a resource usage perspective,
EFI_SECURITY_VIOLATION must be considered "success", and rolled back.

Implement this rollback, without breaking the proper "nesting" of error
handling jumps and labels.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Fixes: 23d04b58e2
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2019-09-05 19:22:43 +02:00
..
ArmVirtDxeHobLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
ArmVirtGicArchLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
ArmVirtMemoryInitPeiLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
ArmVirtPL031FdtClientLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
ArmVirtPsciResetSystemLib ArmVirtPkg/ArmVirtPsciResetSystemLib: Add a new API ResetSystem 2019-04-28 09:40:20 +08:00
ArmVirtTimerFdtClientLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
BaseCachingPciExpressLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
FdtPL011SerialPortLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
FdtPciHostBridgeLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
FdtPciPcdProducerLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
NorFlashQemuLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
PlatformBootManagerLib ArmVirtPkg/PlatformBootManagerLib: unload image on EFI_SECURITY_VIOLATION 2019-09-05 19:22:43 +02:00
PlatformPeiLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
QemuFwCfgLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
QemuVirtMemInfoLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
XenArmGenericTimerVirtCounterLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
XenVirtMemInfoLib ArmVirtPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00