Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OcApfsLib: Always load JumpStart APFS directly #520

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OpenCore Changelog
- Enabled use of picker shortcut keys which are read out in OpenCanopy when using `PickerAudioAssist`
- Modified builtin picker so as not to respond to keys queued while audio assist menu is being read out
- Fixed Linux EFI stub loading error when using OpenDuet since 0.8.8
- Fixed APFS JumpStart with OpenDuet and `SecureBootModel` `Disabled`

#### v0.9.7
- Updated recovery_urls.txt
Expand Down
36 changes: 11 additions & 25 deletions Library/OcApfsLib/OcApfsConnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,10 @@ ApfsStartDriver (
IN UINT32 DriverSize
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE ImageHandle;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_IMAGE_LOAD LoadImage;
APPLE_SECURE_BOOT_PROTOCOL *SecureBoot;
UINT8 Policy;
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE ImageHandle;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;

Status = PeCoffVerifyAppleSignature (
DriverBuffer,
Expand Down Expand Up @@ -279,27 +276,16 @@ ApfsStartDriver (
DevicePath = NULL;
}

SecureBoot = OcAppleSecureBootGetProtocol ();
ASSERT (SecureBoot != NULL);
Status = SecureBoot->GetPolicy (
SecureBoot,
&Policy
);
//
// Load directly when we have Apple Secure Boot.
// - Either normal.
// - Or during DMG loading.
// Always load jump started APFS directly - we cannot always successfully
// pass the sanitized image to OC-wrapped platform loader, because apfs.efi
// has W^X errors which require fixup for strict loaders, however the fact
// that apfs.efi instances are Apple signed images cannot be detected again
// after sanitisation (i.e. in ImageLoader.c in order to apply fixup before
// a strict - e.g. Duet - platform loader sees it).
//
if ( (!EFI_ERROR (Status) && (Policy != AppleImg4SbModeDisabled))
|| (OcAppleSecureBootGetDmgLoading (&Policy) && (Policy != AppleImg4SbModeDisabled)))
{
LoadImage = OcImageLoaderLoad;
} else {
LoadImage = gBS->LoadImage;
}

ImageHandle = NULL;
Status = LoadImage (
Status = OcImageLoaderLoad (
FALSE,
gImageHandle,
DevicePath,
Expand Down