* 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 is long-standing bug, going back to the transition from
EFI to UEFI (tianore/edk to tianocore/edk2).
The default ACPI level was changed from 1.0 to 2.0, but this
code in Duet was not changed to match.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Early Mac EFI returns EFI_INVALID_PARAMETER if storage for any single
NVRAM variable exceeds a certain size (leaves 2006 bytes for the value,
if the variable has a 4 character name). Since all of fsXX:\efi\tools\,
fsXX:\efi\boot\ and fsXX:\ are added to a CHAR16 shell `path` variable
for each file system found, the variable exceeds this limit when there
are greater than 25 file systems.
In the RELEASE shell this causes the `path` variable to get set to a
strange value. Unfortunately in the DEBUG shell it causes an ASSERT
and the shell does not start.
With this patch the DEBUG shell behaves like RELEASE shell: due to the
implementation of ShellProtocol SetEnv, when there is an error the
variable gets deleted and not recreated, thus the final path variable
only contains paths for file systems after the one which caused the
error. While this patch is not an ideal fix for the underlying problem,
it does simply recreate the longstanding behaviour of the RELEASE shell
on the same systems, and is preferable to the DEBUG shell being unusable.
Addresses https://github.com/acidanthera/bugtracker/issues/2005
This feature adds support for UEFI Event in userspace. The
following has been implemented:
- The number of events if fixed
- Event dispatching occurs through an explicit call to
the dispatcher from UEFI Event functions
- Event groups are not supported
Signed-off-by: Pavel Naberezhnev <pavelnaberezhnev@gmail.com>
Newly added example demonstrates patching RTC device supporting 2 I/O
ports which are reported as 8 I/O ports in ACPI. The patch fixes
PowerManagement crashes in e.g. 10.6 and newer in OVMF.
OcLoadConsoleFont currently loads the specified console path from
Resources\Font\\, which can cause vault failures if vault.plist doesn't
include the duplicate path separator. Remove it to match other paths.
Prior to macOS 10.5 the logic used to interpret PHY status was wrong.
AppleIntel8254XEthernet checks PHY Specific Status register for bit 3
(Transmit Pause Enabled) presence instead of bit 10 (Link).
This patch forces PHY Specific Status register 0xac08, which means
always up.
This is needed to Force inject longer kexts, e.g. networking:
System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/
AppleIntel8254XEthernet.kext/Contents/MacOS/AppleIntel8254XEthernet
OpenDuet includes unmodified VariableRuntimeDxe. OpenVariableRuntimeDxe
is a slightly modified variant of that (see comments in header of VariableDxe.c).