mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-24 06:04:52 +02:00
SysCall: Disabled global pages, set User page table attibutes in
paging syscalls.
This commit is contained in:
parent
7720181673
commit
58038f62ad
@ -605,6 +605,14 @@ CallBootService (
|
|||||||
*(EFI_PHYSICAL_ADDRESS *)UserRsp->Arguments[4] = (EFI_PHYSICAL_ADDRESS)Argument4;
|
*(EFI_PHYSICAL_ADDRESS *)UserRsp->Arguments[4] = (EFI_PHYSICAL_ADDRESS)Argument4;
|
||||||
ForbidSupervisorAccessToUserMemory ();
|
ForbidSupervisorAccessToUserMemory ();
|
||||||
|
|
||||||
|
gCpu->SetUserMemoryAttributes (
|
||||||
|
gCpu,
|
||||||
|
gUserPageTable,
|
||||||
|
Argument4,
|
||||||
|
EFI_PAGES_TO_SIZE (CoreRbp->Argument3),
|
||||||
|
EFI_MEMORY_USER
|
||||||
|
);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
case SysCallFreePages:
|
case SysCallFreePages:
|
||||||
@ -617,6 +625,14 @@ CallBootService (
|
|||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(CoreRbp->Argument2 + CoreRbp->Argument1 * EFI_PAGE_SIZE - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(CoreRbp->Argument2 + CoreRbp->Argument1 * EFI_PAGE_SIZE - 1), &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
|
|
||||||
|
gCpu->SetUserMemoryAttributes (
|
||||||
|
gCpu,
|
||||||
|
gUserPageTable,
|
||||||
|
CoreRbp->Argument2,
|
||||||
|
EFI_PAGES_TO_SIZE (CoreRbp->Argument1),
|
||||||
|
EFI_MEMORY_RP
|
||||||
|
);
|
||||||
|
|
||||||
return gBS->FreePages (
|
return gBS->FreePages (
|
||||||
*(EFI_PHYSICAL_ADDRESS *)&CoreRbp->Argument2,
|
*(EFI_PHYSICAL_ADDRESS *)&CoreRbp->Argument2,
|
||||||
CoreRbp->Argument1
|
CoreRbp->Argument1
|
||||||
|
@ -188,8 +188,12 @@ InitializeMsr (
|
|||||||
Ebx = 0;
|
Ebx = 0;
|
||||||
Edx = 0;
|
Edx = 0;
|
||||||
|
|
||||||
// The Intel-64 and IA-32 architectures also allow for global pages when the PGE flag (bit 7) is 1 in CR4.
|
//
|
||||||
// PGE must be zero.
|
// Forbid global pages.
|
||||||
|
//
|
||||||
|
Cr4.UintN = AsmReadCr4 ();
|
||||||
|
Cr4.Bits.PGE = 0;
|
||||||
|
AsmWriteCr4 (Cr4.UintN);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Forbid supervisor-mode accesses to any user-mode pages.
|
// Forbid supervisor-mode accesses to any user-mode pages.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user