From 5933048c69edb546f1e93c26dc93816f0be9f754 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 12 Jun 2009 21:47:04 -0600 Subject: module: cleanup FIXME comments about trimming exception table entries. Everyone cut and paste this comment from my original one. We now do it generically, so cut the comments. Signed-off-by: Rusty Russell Cc: Amerigo Wang --- arch/avr32/kernel/module.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/avr32/kernel') diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c index 1167fe9cf6c..98f94d041d9 100644 --- a/arch/avr32/kernel/module.c +++ b/arch/avr32/kernel/module.c @@ -32,8 +32,6 @@ void module_free(struct module *mod, void *module_region) mod->arch.syminfo = NULL; vfree(module_region); - /* FIXME: if module_region == mod->init_region, trim exception - * table entries. */ } static inline int check_rela(Elf32_Rela *rela, struct module *module, -- cgit v1.2.3-70-g09d2 From bb6e647051a59dca5a72b3deef1e061d7c1c34da Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Wed, 3 Jun 2009 14:29:16 +0200 Subject: 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 --- arch/avr32/kernel/traps.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'arch/avr32/kernel') diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index d547c8df157..6e3d491184e 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, { 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; -- cgit v1.2.3-70-g09d2