]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
riscv: Clear SUM in SSTATUS for supervisor mode exceptions.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 21 Apr 2021 20:57:04 +0000 (13:57 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 23 Nov 2021 23:47:52 +0000 (15:47 -0800)
commite1d8f7fc1d9457c5db18d1639f1fdfb244476106
treea09a9af078b811e061eb5272021cff11ffed28ea
parentd7b47e163dc7bed63e10e231e0c38451f8787d1b
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)
sys/riscv/riscv/exception.S