diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-06-03 08:29:16 -0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-06-13 09:57:30 -0400 |
commit | bb6e647051a59dca5a72b3deef1e061d7c1c34da (patch) | |
tree | 6b6ee5c3381e4e84560dc55f200190b1388e76d6 /arch/avr32/kernel | |
parent | fbe0b8d5822a88e2e769a318eaf3134da5881769 (diff) |
avr32: Fix oops on unaligned user access
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>
Diffstat (limited to 'arch/avr32/kernel')
-rw-r--r-- | arch/avr32/kernel/traps.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index d547c8df157d..6e3d491184ea 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c | |||
@@ -75,8 +75,17 @@ void _exception(long signr, struct pt_regs *regs, int code, | |||
75 | { | 75 | { |
76 | siginfo_t info; | 76 | siginfo_t info; |
77 | 77 | ||
78 | if (!user_mode(regs)) | 78 | if (!user_mode(regs)) { |
79 | const struct exception_table_entry *fixup; | ||
80 | |||
81 | /* Are we prepared to handle this kernel fault? */ | ||
82 | fixup = search_exception_tables(regs->pc); | ||
83 | if (fixup) { | ||
84 | regs->pc = fixup->fixup; | ||
85 | return; | ||
86 | } | ||
79 | die("Unhandled exception in kernel mode", regs, signr); | 87 | die("Unhandled exception in kernel mode", regs, signr); |
88 | } | ||
80 | 89 | ||
81 | memset(&info, 0, sizeof(info)); | 90 | memset(&info, 0, sizeof(info)); |
82 | info.si_signo = signr; | 91 | info.si_signo = signr; |