From: jpihet@mvista.com (Jean Pihet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] check put_user fail in do_signal when enable OABI_COMPACT
Date: Tue, 27 Oct 2009 15:14:53 +0100 [thread overview]
Message-ID: <200910271514.54506.jpihet@mvista.com> (raw)
In-Reply-To: <af3ea28a0910251959id60ad5kf95dd1f908fa55c9@mail.gmail.com>
Russell, Janboe,
On Monday 26 October 2009 03:59:23 ye janboe wrote:
> Sure. Russell
>
> After you restart_syscall patch are merged, I will send out another patch.
Here is what I ended up with after merging.
It has been tested on OMAP3 boards although I could not trigger the failing
put_user test case.
What do you think?
Regards,
Jean
>From dcaf0812f86948fe1c9dbb9fe53e9040f5a6deeb Mon Sep 17 00:00:00 2001
From: Jean Pihet <jpihet@mvista.com>
Date: Tue, 27 Oct 2009 10:09:22 +0100
Subject: ARM: Check put_user fail in do_signal when enable OABI_COMPAT
Using OABI, do_signal need to copy restart_syscall to user stack.
It is possible that put_user fail. This triggers flush_icache page
fault and crash kernel.
Signed-off-by: janboe <janboe.ye@gmail.com>
Merged from
http://lists.infradead.org/pipermail/linux-arm-kernel/2009-October/002621.html
on top of
http://marc.info/?l=linux-arm-kernel&m=125638133624452&w=2
Tested with multiple sleeping apps/threads (using the nanosleep syscall) and
suspend/resume.
Signed-off-by: Jean Pihet <jpihet@mvista.com>
---
arch/arm/kernel/signal.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 998fa8d..8ac56fe 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -643,6 +643,7 @@ static int do_signal(sigset_t *oldset, struct pt_regs
*regs, int syscall)
struct k_sigaction ka;
siginfo_t info;
int signr;
+ int ret = 0;
/*
* We want the common case to go fast, which
@@ -685,8 +686,15 @@ static int do_signal(sigset_t *oldset, struct pt_regs
*regs, int syscall)
regs->ARM_sp -= 4;
usp = (u32 __user *)regs->ARM_sp;
- put_user(regs->ARM_pc, usp);
- regs->ARM_pc = KERN_RESTART_CODE;
+ ret |= put_user(regs->ARM_pc, usp);
+ if (!ret) {
+ flush_icache_range((unsigned long)usp,
+ (unsigned long)(usp + 1));
+ regs->ARM_pc = KERN_RESTART_CODE;
+ } else {
+ regs->ARM_sp += 4;
+ force_sigsegv(0, current);
+ }
#endif
}
}
--
>
> Thanks
>
> 2009/10/25 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> > On Sun, Oct 25, 2009 at 02:23:09PM +0800, ye janboe wrote:
> >> hi, Russell
> >>
> >> Your patch looks good for real fixing this issue.
> >
> > My patch doesn't address your issue, it only addresses a previous
> > problem. ?We're still decrementing the stack pointer and writing to
> > a possible new page - which could fault.
> >
> > Therefore, your patch is still required, but it needs to be modified
> > to apply on top of my patch.
> >
> > A replacement patch would be welcome.
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2009-10-27 14:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-21 11:07 [PATCH] check put_user fail in do_signal when enable OABI_COMPACT Janboe Ye
2009-10-22 3:35 ` ye janboe
2009-10-24 10:49 ` Russell King - ARM Linux
2009-10-25 6:23 ` ye janboe
2009-10-25 15:44 ` Russell King - ARM Linux
2009-10-26 2:59 ` ye janboe
2009-10-27 14:14 ` Jean Pihet [this message]
2009-10-27 14:28 ` Russell King - ARM Linux
2009-10-27 14:41 ` ye janboe
2009-10-27 15:42 ` Mikael Pettersson
2009-10-27 17:57 ` Jean Pihet
2009-10-27 18:08 ` Nicolas Pitre
2009-10-27 18:37 ` Jean Pihet
2009-10-27 18:59 ` Nicolas Pitre
2009-10-27 19:12 ` Jean Pihet
2009-10-27 19:35 ` Nicolas Pitre
2009-10-27 19:42 ` Russell King - ARM Linux
2009-10-27 19:52 ` Nicolas Pitre
2009-10-28 10:16 ` Jean Pihet
2009-10-28 16:13 ` Nicolas Pitre
2009-10-28 16:23 ` Jean Pihet
2009-10-28 17:00 ` Jean Pihet
2009-10-28 17:24 ` Nicolas Pitre
2009-10-28 19:32 ` Jamie Lokier
2009-11-04 13:33 ` Jean Pihet
2009-11-04 19:32 ` Russell King - ARM Linux
2009-11-23 13:59 ` Jean Pihet
2009-11-23 14:06 ` Russell King - ARM Linux
2009-11-23 16:20 ` Jean Pihet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200910271514.54506.jpihet@mvista.com \
--to=jpihet@mvista.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).