amd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys.
Non-PTI mode does not switch kcr3, which means that kcr3 is almost always stale. This is important for the NMI handler, which reloads %cr3 with PCPU(kcr3) if the value is different from PMAP_NO_CR3. The end result is that curpmap in NMI handler does not match the page table loaded into hardware. The manifestation was copyin(9) looping forever when a usermode access page fault cannot be resolved by vm_fault() updating a different page table. Reported by: mmacy Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Approved by: re (gjb)
This commit is contained in:
parent
316086bd6c
commit
e21c5abc2a
@ -7582,9 +7582,13 @@ pmap_activate_boot(pmap_t pmap)
|
||||
CPU_SET(cpuid, &pmap->pm_active);
|
||||
#endif
|
||||
PCPU_SET(curpmap, pmap);
|
||||
kcr3 = pmap->pm_cr3;
|
||||
if (pmap_pcid_enabled)
|
||||
kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE;
|
||||
if (pti) {
|
||||
kcr3 = pmap->pm_cr3;
|
||||
if (pmap_pcid_enabled)
|
||||
kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE;
|
||||
} else {
|
||||
kcr3 = PMAP_NO_CR3;
|
||||
}
|
||||
PCPU_SET(kcr3, kcr3);
|
||||
PCPU_SET(ucr3, PMAP_NO_CR3);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user