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
This commit is contained in:
Kristof Provost 2020-10-02 07:30:11 +00:00
parent 7676c62aa3
commit 75f022774f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366355

View File

@ -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: