HomeFreeBSD

riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Description

riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses. This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by: mhorne, jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29763

(cherry picked from commit 753bcca440a4d2c95f48536b586131b84c0bb87e)

Details

Provenance
jhbAuthored on Apr 21 2021, 8:57 PM
Reviewer
mhorne
Differential Revision
D29763: riscv: Clear SUM in SSTATUS for supervisor mode exceptions.
Parents
rGd7b47e163dc7: ktls: Split encrypt vs decrypt OCF counters.
Branches
Unknown
Tags
Unknown