riscv: Clear SUM in SSTATUS for supervisor mode exceptions.
authorjsg <jsg@openbsd.org>
Wed, 5 May 2021 01:24:57 +0000 (01:24 +0000)
committerjsg <jsg@openbsd.org>
Wed, 5 May 2021 01:24:57 +0000 (01:24 +0000)
From John Baldwin
753bcca440a4d2c95f48536b586131b84c0bb87e in FreeBSD

ok kettenis@ mlarkin@

sys/arch/riscv64/riscv64/exception.S

index 7d461ff..d8a7e3c 100644 (file)
        sd      t0, (TF_SEPC)(sp)
        csrr    t0, sstatus
        sd      t0, (TF_SSTATUS)(sp)
+.if \el == 1
+       /* Disable user address access for supervisor mode exceptions. */
+       li      t0, SSTATUS_SUM
+       csrc    sstatus, t0
+.endif
        csrr    t0, stval
        sd      t0, (TF_STVAL)(sp)
        csrr    t0, scause