kernel: mmu: fix assigning unaligned addr to page frame
In do_page_fault(), the incoming page fault address is not aligned, and it was unconditionally assigned to the page frame virtual address field. If the backing store simply returns the virtual address without processing in k_mem_paging_backing_store_location_get(), this unaligned address will be passed to arch_mem_page_out(). On x86, it is further passed to range_map() which asserts if the physical address is not page aligned. So align the address to page size before assigning it to the page frame virtual address field. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
54c4525094
commit
c38634fa33
1 changed files with 3 additions and 1 deletions
|
@ -1288,7 +1288,9 @@ static bool do_page_fault(void *addr, bool pin)
|
|||
pf->flags |= Z_PAGE_FRAME_PINNED;
|
||||
}
|
||||
pf->flags |= Z_PAGE_FRAME_MAPPED;
|
||||
pf->addr = addr;
|
||||
pf->addr = UINT_TO_POINTER(POINTER_TO_UINT(addr)
|
||||
& ~(CONFIG_MMU_PAGE_SIZE - 1));
|
||||
|
||||
arch_mem_page_in(addr, z_page_frame_to_phys(pf));
|
||||
k_mem_paging_backing_store_page_finalize(pf, page_in_location);
|
||||
out:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue