Set PTE_U on PTEs created by pmap_enter_quick().
Otherwise prefaulted entries are not accessible from user mode and end up triggering a fault upon access, so prefaulting has no effect. Reviewed by: jhb, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18718
This commit is contained in:
parent
619999ff9f
commit
8ccaccd522
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342733
@ -2365,19 +2365,14 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
*/
|
||||
pmap_resident_count_inc(pmap, 1);
|
||||
|
||||
pa = VM_PAGE_TO_PHYS(m);
|
||||
pn = (pa / PAGE_SIZE);
|
||||
|
||||
entry = PTE_V | PTE_R;
|
||||
if (prot & VM_PROT_EXECUTE)
|
||||
entry |= PTE_X;
|
||||
entry |= (pn << PTE_PPN0_S);
|
||||
|
||||
/*
|
||||
* Now validate mapping with RO protection
|
||||
*/
|
||||
newl3 = ((VM_PAGE_TO_PHYS(m) / PAGE_SIZE) << PTE_PPN0_S) |
|
||||
PTE_V | PTE_R;
|
||||
if ((prot & VM_PROT_EXECUTE) != 0)
|
||||
newl3 |= PTE_X;
|
||||
if ((m->oflags & VPO_UNMANAGED) == 0)
|
||||
entry |= PTE_SW_MANAGED;
|
||||
newl3 |= PTE_SW_MANAGED;
|
||||
if (va < VM_MAX_USER_ADDRESS)
|
||||
newl3 |= PTE_U;
|
||||
|
||||
/*
|
||||
* Sync the i-cache on all harts before updating the PTE
|
||||
@ -2386,7 +2381,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
if (prot & VM_PROT_EXECUTE)
|
||||
pmap_sync_icache(pmap, va, PAGE_SIZE);
|
||||
|
||||
pmap_store(l3, entry);
|
||||
pmap_store(l3, newl3);
|
||||
|
||||
pmap_invalidate_page(pmap, va);
|
||||
return (mpte);
|
||||
|
Loading…
Reference in New Issue
Block a user