HomeFreeBSD

riscv: Permit spurious faults in kernel mode

Description

riscv: Permit spurious faults in kernel mode

Right now, pmap_enter() does not issue an sfence.vma after overwriting
an invalid PTE, so the kernel can trigger a page fault when accessing a
freshly created mapping. In this case, pmap_fault() can handle the
exception, but we may panic before that. Move the check; this is
consistent with arm64 and serves to ensure that we don't call vm_fault()
etc. from a context where that's not permitted.

Also fix a related bug: don't enable interrupts if they were disabled in
the context where the exception occurred.

Reviewed by: br
Tested by: br
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47688

(cherry picked from commit c226f193515c8c0665610cb519fe381987f8ee24)

Details

Provenance
markjAuthored on Dec 10 2024, 3:07 PM
Reviewer
br
Differential Revision
D47688: riscv: Permit spurious faults in kernel mode
Parents
rG9e4acacf88f8: timeout(1): Some minor tweaks and improvements
Branches
Unknown
Tags
Unknown