Ring3: Prevented loading of DxeRing3 driver, when UserSpace is disabled.

This commit is contained in:
Mikhail Krichanov 2025-01-30 18:36:01 +03:00
parent b6a7e2b3be
commit 8671f61ca4
2 changed files with 9 additions and 3 deletions

View File

@ -29,11 +29,10 @@ DebugLibFdtPL011UartUserConstructor (
for (Index = 0; Index < SystemTable->NumberOfTableEntries; ++Index) {
if (CompareGuid (&gEarlyPL011BaseAddressGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {
mDebugLibFdtPL011UartAddress = (UINTN)SystemTable->ConfigurationTable[Index].VendorTable;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
return EFI_SUCCESS;
}
/**

View File

@ -23,6 +23,7 @@ typedef struct {
STATIC LIST_ENTRY mAvailableEmulators;
STATIC EFI_EVENT mPeCoffEmuProtocolRegistrationEvent;
STATIC VOID *mPeCoffEmuProtocolNotifyRegistration;
STATIC BOOLEAN mDxeRing3 = TRUE;
extern BOOLEAN gBdsStarted;
@ -1348,6 +1349,12 @@ CoreLoadImageCommon (
Image->Info.ParentHandle = ParentImageHandle;
Image->IsUserImage = (FileAttributes & EFI_FV_FILE_ATTRIB_USER) != 0;
if ((!PcdGetBool (PcdEnableUserSpace)) && Image->IsUserImage && mDxeRing3) {
mDxeRing3 = FALSE;
Status = EFI_NOT_STARTED;
goto Done;
}
if (NumberOfPages != NULL) {
Image->NumberOfPages = *NumberOfPages;
} else {
@ -1444,7 +1451,7 @@ CoreLoadImageCommon (
Status = EFI_SUCCESS;
ProtectUefiImage (&Image->Info, ImageOrigin, &ImageContext, Image->IsUserImage);
if ((gRing3Data != NULL) && Image->IsUserImage) {
if (PcdGetBool (PcdEnableUserSpace) && (gRing3Data != NULL) && Image->IsUserImage) {
Image->UserPageTable = InitializeUserPageTable (Image);
}