Skip to content

Commit

Permalink
avr32: Fix oops on unaligned user access
Browse files Browse the repository at this point in the history
The unaligned address exception handler (and others) does not scan the
fixup tables before oopsing. This is bad because it means passing a
badly aligned pointer from user space might crash the kernel.

Fix this by scanning the fixup tables in _exception(). This should
resolve the issue for unaligned addresses as well as other less common
exceptions that might be happening during a userspace access. The page
fault handler already does fixup processing.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
  • Loading branch information
Haavard Skinnemoen committed Jun 13, 2009
1 parent fbe0b8d commit bb6e647
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arch/avr32/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ void _exception(long signr, struct pt_regs *regs, int code,
{
siginfo_t info;

if (!user_mode(regs))
if (!user_mode(regs)) {
const struct exception_table_entry *fixup;

/* Are we prepared to handle this kernel fault? */
fixup = search_exception_tables(regs->pc);
if (fixup) {
regs->pc = fixup->fixup;
return;
}
die("Unhandled exception in kernel mode", regs, signr);
}

memset(&info, 0, sizeof(info));
info.si_signo = signr;
Expand Down

0 comments on commit bb6e647

Please sign in to comment.