Fix a race when the hardware has raised an exception with an unknown or

uncategorised reason. We need to read the fault address register before
enabling interrupts as the interrupt handler may cause this register to
change.

Approved by:	re (marius, kib)
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
andrew 2016-06-22 12:05:08 +00:00
parent 2b26f1f44b
commit 4c327142ba

View File

@ -313,13 +313,11 @@ do_el1h_sync(struct trapframe *frame)
* instruction results in an exception with an unknown reason.
*/
static void
el0_excp_unknown(struct trapframe *frame)
el0_excp_unknown(struct trapframe *frame, uint64_t far)
{
struct thread *td;
uint64_t far;
td = curthread;
far = READ_SPECIALREG(far_el1);
call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far);
userret(td, frame);
}
@ -342,6 +340,7 @@ do_el0_sync(struct trapframe *frame)
esr = READ_SPECIALREG(esr_el1);
exception = ESR_ELx_EXCEPTION(esr);
switch (exception) {
case EXCP_UNKNOWN:
case EXCP_INSN_ABORT_L:
case EXCP_DATA_ABORT_L:
case EXCP_DATA_ABORT:
@ -371,7 +370,7 @@ do_el0_sync(struct trapframe *frame)
data_abort(frame, esr, far, 1);
break;
case EXCP_UNKNOWN:
el0_excp_unknown(frame);
el0_excp_unknown(frame, far);
break;
case EXCP_SP_ALIGN:
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp);