Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3522bcf

Browse files
committed
xtensa: always install slow handler for unaligned access exception
Currently slow handler for unaligned access exception is not installed when CPU has hardware support for unaligned access. However some opcodes (e.g. l32ai, s32ri, s32c1i) would still raise unaligned access exception even on such CPUs. In that case instead of SIGBUS and a diagnostic entry in the kernel log the faulting process would receive SIGILL. Always install slow handler for unaligned access exception to fix that. Signed-off-by: Max Filippov <[email protected]>
1 parent 67e8862 commit 3522bcf

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

arch/xtensa/kernel/traps.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ static void do_interrupt(struct pt_regs *regs);
5454
#if XTENSA_FAKE_NMI
5555
static void do_nmi(struct pt_regs *regs);
5656
#endif
57-
#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
5857
static void do_unaligned_user(struct pt_regs *regs);
59-
#endif
6058
static void do_multihit(struct pt_regs *regs);
6159
#if XTENSA_HAVE_COPROCESSORS
6260
static void do_coprocessor(struct pt_regs *regs);
@@ -102,9 +100,9 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
102100
#ifdef CONFIG_XTENSA_UNALIGNED_USER
103101
{ EXCCAUSE_UNALIGNED, USER, fast_unaligned },
104102
#endif
105-
{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
106103
{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned },
107104
#endif
105+
{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
108106
#ifdef CONFIG_MMU
109107
{ EXCCAUSE_ITLB_MISS, 0, do_page_fault },
110108
{ EXCCAUSE_ITLB_MISS, USER|KRNL, fast_second_level_miss},
@@ -356,7 +354,6 @@ static void do_div0(struct pt_regs *regs)
356354
* accesses causes from user space.
357355
*/
358356

359-
#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
360357
static void do_unaligned_user(struct pt_regs *regs)
361358
{
362359
__die_if_kernel("Unhandled unaligned exception in kernel",
@@ -368,7 +365,6 @@ static void do_unaligned_user(struct pt_regs *regs)
368365
task_pid_nr(current), regs->pc);
369366
force_sig_fault(SIGBUS, BUS_ADRALN, (void *) regs->excvaddr);
370367
}
371-
#endif
372368

373369
#if XTENSA_HAVE_COPROCESSORS
374370
static void do_coprocessor(struct pt_regs *regs)

0 commit comments

Comments
 (0)