* Incorrect EFI_FILE_PROTOCOL version
The driver implements EFI_FILE_PROTOCOL_REVISION version,
not EFI_FILE_PROTOCOL_REVISION2 version.
* Fix directory reading logic by implementing EFI_FILE_INFO cache
Problem:
According to the UEFI specification, reading from a directory must
return zero Size for the EFI_FILE_INFO structure when directory
entries are exhausted. The original FileReadDir() implementation
always returned a fixed EFI_FILE_INFO size before reporting
end-of-directory. This caused fuzzing tests to enter an infinite
directory iteration loop due to unexpected behavior.
Solution:
Introduced an EFI_FILE_INFO cache with the following logic:
1. FileReadDir() caches EFI_FILE_INFO on first read. The cache key
combines directory path hash (with FNV-1a 64-bit hashing) and
DirIndex value
2. When the key matches and buffer size is sufficient:
- Data is returned from cache
- Cache is cleared
3. When the key matches with insufficent buffer size:
- Cache is preserved for subsequent retries
4. Key mismatch triggers cache reset
Additional benefits:
- Eliminates fixed MINIMUM_INFO_LENGTH requirement
- FileReadDir() now requests only required buffer size
Note:
A more elegant solution is being considered for future NTFS
driver improvements, requiring further analysis and testing.
Links:
FNV Hash: http://www.isthe.com/chongo/tech/comp/fnv/index.html
* Fix memory leak in FileReadDir() function
Function NtfsOppen() allocates additional memory for
file structure. After use it, need to free by call FreeFile()
function.
* Fixed invalid pointer access in ReadAttr() function
Solution:
- Added a null check for the Current field in ReadAttr() function
- Added validation for MFT record flags in the InitFile() function
Signed-off-by: Pavel Naberezhnev <pavelnaberezhnev@gmail.com>
This quirk is needed to boot macOS 10.7 and older when using a 32-bit kernel on a 64-bit UEFI firmware that makes uses of FPU or SSE instructions in runtime services (such as Hyper-V).
- Avoid potentially leaving one boot where BOOTSERVICE_ACCESS variable
can be written by OS
- Remove incorrect implication that OpenCore's NVRAM reset will clear
static4 settings
Normally only useful for our HttpBootDxe, which supports HTTP
boot from static IP address as long as URI is also pre-specified.
The NVRAM setting should affect normal EDK II derived network stacks
and will configure a static IP on the card, but this will later be
ignored and overridden by DHCP when PXE or HTTP boot is started in the
standard network stack.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
In GRUB2+blscfg mode:
- Allow grub vars in 'initrd' as well as in 'options'
- Allow multiple initrd files on one 'initrd' line
- Initialise empty $tuned_params and $tuned_initrd grub vars if no
values present, on an optional flag enabled by default (since
we want to make booting major distros easy)
In GRUB2+blscfg mode (seem to be allowed now, not required for fix):
- Allow multiple 'initrd' lines
- Allow multiple 'options' lines
Add variant of OcParseVars which can parse as value-only tokens.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
The renderer already (esp. since recent changes incl. reset to controlled on cls)
manages its own transitions to controlled, so we just need to indicate uncontrolled
in cases where something else has been rendering graphics
- Clear console screen on change to console mode
- Ensure entire screen is cleared at least once in console mode
o Was not needed/was done by default, prior to a189bd53bc2ac1490dac7125a9ce11fd03571755
o Remove GOP clear screen work-around no longer required with this change.
- These changes improve EnableGop driver in the same way, so update version number
o Add EnableGop version in UI section, to enable tool builders to track it