* fix unaligned and nonexistent address handling
@ 2009-01-21 0:42 SUGIOKA Toshinobu
2009-01-21 10:37 ` Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: SUGIOKA Toshinobu @ 2009-01-21 0:42 UTC (permalink / raw)
To: linux-sh
unaligned and nonexistent address causes wrong exception
handling in traps_32.c(handle_unaligned_access).
'handle_unalinged_ins' should return -EFAULT if address error
is fixed up with kernel exception table, otherwise
'handle_unaligned_access' increases already fixed program counter
and then crash.
for example
ioctl(fd, TCGETA, (struct termio *)-1)
never return and stay in TASK_UNINTERRUPTIBLE state forever
in my kernel.
Signed-off-by: SUGIOKA Toshinobu <sugioka@itonet.co.jp>
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index c0aa3d8..60dcf87 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -125,20 +125,18 @@ static inline void die_if_kernel(const char *str, struct pt_regs *regs,
* - userspace errors just cause EFAULT to be returned, resulting in SEGV
* - kernel/userspace interfaces cause a jump to an appropriate handler
* - other kernel errors are bad
- * - return 0 if fixed-up, -EFAULT if non-fatal (to the kernel) fault
*/
-static int die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
+static void die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
{
if (!user_mode(regs)) {
const struct exception_table_entry *fixup;
fixup = search_exception_tables(regs->pc);
if (fixup) {
regs->pc = fixup->fixup;
- return 0;
+ return;
}
die(str, regs, err);
}
- return -EFAULT;
}
static inline void sign_extend(unsigned int count, unsigned char *dst)
@@ -314,7 +312,8 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
/* Argh. Address not only misaligned but also non-existent.
* Raise an EFAULT and see if it's trapped
*/
- return die_if_no_fixup("Fault in unaligned fixup", regs, 0);
+ die_if_no_fixup("Fault in unaligned fixup", regs, 0);
+ return -EFAULT;
}
/*
SUGIOKA Toshinobu
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: fix unaligned and nonexistent address handling
2009-01-21 0:42 fix unaligned and nonexistent address handling SUGIOKA Toshinobu
@ 2009-01-21 10:37 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2009-01-21 10:37 UTC (permalink / raw)
To: linux-sh
On Wed, Jan 21, 2009 at 09:42:10AM +0900, SUGIOKA Toshinobu wrote:
> unaligned and nonexistent address causes wrong exception
> handling in traps_32.c(handle_unaligned_access).
>
> 'handle_unalinged_ins' should return -EFAULT if address error
> is fixed up with kernel exception table, otherwise
> 'handle_unaligned_access' increases already fixed program counter
> and then crash.
>
> for example
> ioctl(fd, TCGETA, (struct termio *)-1)
> never return and stay in TASK_UNINTERRUPTIBLE state forever
> in my kernel.
>
> Signed-off-by: SUGIOKA Toshinobu <sugioka@itonet.co.jp>
>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-21 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 0:42 fix unaligned and nonexistent address handling SUGIOKA Toshinobu
2009-01-21 10:37 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox