Some environments restrict images from running if sections are not page-aligned, because this prevents them from fully enforcing section protections such as RO and NX in hardware via page tables.
Also increase the file alignment to match the new section alignment, because identical file and section alignments are a requirement for running images as XIP. XIP execution is not the norm for EfiGuard, but it at least shouldn't be prevented over a few KBs of difference in binary file size.
This commit fixes a bug that was causing ImgpValidateImageHash to not be found in bootmgfw/bootmgr.efi 10.0.26100.0, due to a false positive match from Zydis being incorrectly accepted. The found 'instruction' address was actually part of a CRC lookup table. This means the address has no matching runtime function metadata in the PE exception directory, and this check is now used to ignore any such results.
Additionally, pre-emptively add this check anywhere it should logically succeed. The runtime overhead of doing this is very small relative to the instruction decoding we are already doing anyway.
This function is highly PE-specific, and pe.c is therefore a more suitable TU.
Also rename it to FindFunctionStart, so as to not imply that any state (e.g. the virtual runtime address used for decoding, ..) is modified, nor that we necessarily need to be backtracking when calling it. This function can also be used more generally to verify whether an address is part of any function at all according to the PE exception directory.
Misc: minor const correctness fixes
Reason is the same as the last commit. EDK2 now also requires an implementation of a 'StackCheckLib' in addition to the (still unfixed) issues already mentioned in #134.
Re-add the missing headers for EFI_LEGACY_BIOS_PROTOCOL and gEfiLegacyBiosGuid which were removed from OvmfPkg in 9d4becddba.
Neither OVMF nor EfiGuard actually *needs* the CSM for anything, but being able to check for the presence of the legacy BIOS protocol is still important in order to determine if we are actually booting a legacy BIOS boot option. This allows us to then inform the user that what they are doing is not suppported and most likely a mistake.
Fixes#119
Override the unwanted /GS flag addition (MSVC) and -fno-stack-protector removal (GCC) introduced in f53f029122
Additionally remove some other (less harmful but still unwanted) build flags that have been made the default in MSVC in the .vcxproj/.props files as well.
Fixes#134
This works around a Windows Shell issue when launching console applications that require admin elevation (this includes EfiDSEFix) from an unelevated command prompt while having UAC enabled.
Fixes#75
The interactive driver configuration now requires the HOME key to be pressed when the loader is started. If it is not pressed, the default configuration will be used as before.
The CONFIGURE_DRIVER compile time define is no longer useful due to this change and has been removed.
- Add primitive aspect ratio weighting when determining which text mode is best
- Move all uses of gST->ConOut to SetHighestAvailableTextMode and exit early if it is NULL