ARM64: Treat alignment faults as bus errors
Summary: ARM64 currently treats all data abort exceptions as page faults. This can cause infinite loops on non-page fault faults, such as alignment faults. Since kernel-side alignment faults should be avoided, this adds support directly to the el0 fault handler, instead of the data_abort() handler. Test Plan: Tested on rpi3, with a misaligned ldm test. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D22133
This commit is contained in:
parent
1bce6aaf96
commit
c7bb190966
@ -87,6 +87,7 @@ int (*dtrace_invop_jump_addr)(struct trapframe *);
|
||||
typedef void (abort_handler)(struct thread *, struct trapframe *, uint64_t,
|
||||
uint64_t, int);
|
||||
|
||||
static abort_handler align_abort;
|
||||
static abort_handler data_abort;
|
||||
|
||||
static abort_handler *abort_handlers[] = {
|
||||
@ -100,6 +101,7 @@ static abort_handler *abort_handlers[] = {
|
||||
[ISS_DATA_DFSC_PF_L1] = data_abort,
|
||||
[ISS_DATA_DFSC_PF_L2] = data_abort,
|
||||
[ISS_DATA_DFSC_PF_L3] = data_abort,
|
||||
[ISS_DATA_DFSC_ALIGN] = align_abort,
|
||||
};
|
||||
|
||||
static __inline void
|
||||
@ -165,6 +167,17 @@ svc_handler(struct thread *td, struct trapframe *frame)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
align_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
|
||||
uint64_t far, int lower)
|
||||
{
|
||||
if (!lower)
|
||||
panic("Misaligned access from kernel space!");
|
||||
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
|
||||
userret(td, frame);
|
||||
}
|
||||
|
||||
static void
|
||||
data_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
|
||||
uint64_t far, int lower)
|
||||
|
Loading…
x
Reference in New Issue
Block a user