svn commit: r366355 - head/sys/riscv/riscv
Kristof Provost
kp at FreeBSD.org
Fri Oct 2 07:30:14 UTC 2020
Author: kp
Date: Fri Oct 2 07:30:11 2020
New Revision: 366355
URL: https://svnweb.freebsd.org/changeset/base/366355
Log:
riscv: handle access faults in user mode
Access faults in user mode are treated like TLB misses, which leads to an
endless loop of faults. It's less serious than the same fault in kernel mode,
because we can just terminate the process, but that's not ideal.
Treat user mode access faults as a bus error.
Suggested by: jrtc27
Reviewed by: br, jhb
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26621
Modified:
head/sys/riscv/riscv/trap.c
Modified: head/sys/riscv/riscv/trap.c
==============================================================================
--- head/sys/riscv/riscv/trap.c Fri Oct 2 05:59:55 2020 (r366354)
+++ head/sys/riscv/riscv/trap.c Fri Oct 2 07:30:11 2020 (r366355)
@@ -343,6 +343,10 @@ do_trap_user(struct trapframe *frame)
case EXCP_FAULT_LOAD:
case EXCP_FAULT_STORE:
case EXCP_FAULT_FETCH:
+ call_trapsignal(td, SIGBUS, BUS_ADRERR, (void *)frame->tf_sepc,
+ exception);
+ userret(td, frame);
+ break;
case EXCP_STORE_PAGE_FAULT:
case EXCP_LOAD_PAGE_FAULT:
case EXCP_INST_PAGE_FAULT:
More information about the svn-src-head
mailing list