mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-16 07:15:21 +00:00
hv: mmu: fix wrong to modify a large page attributes
If try to modify a memory region which will cross a large page and the first page virtual address in it would not align to the large page size, it would modify the whole large page attributes which is fatal wrong. Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
parent
5189bcd272
commit
efd5ac4814
@ -123,7 +123,8 @@ static int modify_pde(uint64_t *pdpte,
|
||||
return -EFAULT;
|
||||
}
|
||||
if (pde_large(*pde) != 0UL) {
|
||||
if (vaddr_next > vaddr_end) {
|
||||
if (vaddr_next > vaddr_end ||
|
||||
!MEM_ALIGNED_CHECK(vaddr, PDE_SIZE)) {
|
||||
ret = split_large_page(pde, IA32E_PD, ptt);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
@ -173,7 +174,8 @@ static int modify_pdpte(uint64_t *pml4e,
|
||||
return -EFAULT;
|
||||
}
|
||||
if (pdpte_large(*pdpte) != 0UL) {
|
||||
if (vaddr_next > vaddr_end) {
|
||||
if (vaddr_next > vaddr_end ||
|
||||
!MEM_ALIGNED_CHECK(vaddr, PDPTE_SIZE)) {
|
||||
ret = split_large_page(pdpte, IA32E_PDPT, ptt);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user