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

Details

Provenance
markjAuthored on Dec 10 2024, 3:07 PM
Reviewer
br
Differential Revision
D47688: riscv: Permit spurious faults in kernel mode
Parents
rGe02029e6f487: vmcb.h: fix typo in the comment, try two
Branches
Unknown
Tags
Unknown