public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn()
@ 2008-12-16 22:02 Hiroshi Shimamoto
  2008-12-16 22:03 ` [PATCH 2/3] x86: ia32_signal: use __put_user() instead of __copy_to_user() Hiroshi Shimamoto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2008-12-16 22:02 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Impact: cleanup

Call signal_fault() in error route of sys_sigreturn().
Change log level to KERN_EMERG if current is init.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/kernel/signal.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index dee553c..605592a 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -594,17 +594,7 @@ asmlinkage unsigned long sys_sigreturn(unsigned long __unused)
 	return ax;
 
 badframe:
-	if (show_unhandled_signals && printk_ratelimit()) {
-		printk("%s%s[%d] bad frame in sigreturn frame:"
-			"%p ip:%lx sp:%lx oeax:%lx",
-		    task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
-		    current->comm, task_pid_nr(current), frame, regs->ip,
-		    regs->sp, regs->orig_ax);
-		print_vma_addr(" in ", regs->ip);
-		printk(KERN_CONT "\n");
-	}
-
-	force_sig(SIGSEGV, current);
+	signal_fault(regs, frame, "sigreturn");
 
 	return 0;
 }
@@ -906,8 +896,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
 	struct task_struct *me = current;
 
 	if (show_unhandled_signals && printk_ratelimit()) {
-		printk(KERN_INFO
+		printk("%s"
 		       "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
+		       task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
 		       me->comm, me->pid, where, frame,
 		       regs->ip, regs->sp, regs->orig_ax);
 		print_vma_addr(" in ", regs->ip);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] x86: ia32_signal: use __put_user() instead of __copy_to_user()
  2008-12-16 22:02 [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Hiroshi Shimamoto
@ 2008-12-16 22:03 ` Hiroshi Shimamoto
  2008-12-16 22:04 ` [PATCH 3/3] x86: ia32_signal: use proper macro __USER32_DS Hiroshi Shimamoto
  2008-12-16 22:06 ` [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2008-12-16 22:03 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Impact: cleanup

__put_user() can be used for constant size 8, like arch/x86/kernel/signal.c.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/ia32/ia32_signal.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 9ddf2fa..8738cc5 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -467,7 +467,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
 	 * These are actually not used anymore, but left because some
 	 * gdb versions depend on them as a marker.
 	 */
-	err |= __copy_to_user(frame->retcode, &code, 8);
+	err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode);
 	if (err)
 		return -EFAULT;
 
@@ -554,7 +554,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	 * Not actually used anymore, but left because some gdb
 	 * versions need it.
 	 */
-	err |= __copy_to_user(frame->retcode, &code, 8);
+	err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode);
 	if (err)
 		return -EFAULT;
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] x86: ia32_signal: use proper macro __USER32_DS
  2008-12-16 22:02 [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Hiroshi Shimamoto
  2008-12-16 22:03 ` [PATCH 2/3] x86: ia32_signal: use __put_user() instead of __copy_to_user() Hiroshi Shimamoto
@ 2008-12-16 22:04 ` Hiroshi Shimamoto
  2008-12-16 22:06 ` [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2008-12-16 22:04 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Impact: cleanup

Use __USER32_DS instead of __USER_DS in ia32_signal.c.
No impact, because __USER32_DS is defined __USER_DS.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/ia32/ia32_signal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 8738cc5..ee1ad4a 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -396,7 +396,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 	}
 
 	/* This is the legacy signal stack switching. */
-	else if ((regs->ss & 0xffff) != __USER_DS &&
+	else if ((regs->ss & 0xffff) != __USER32_DS &&
 		!(ka->sa.sa_flags & SA_RESTORER) &&
 		 ka->sa.sa_restorer)
 		sp = (unsigned long) ka->sa.sa_restorer;
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn()
  2008-12-16 22:02 [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Hiroshi Shimamoto
  2008-12-16 22:03 ` [PATCH 2/3] x86: ia32_signal: use __put_user() instead of __copy_to_user() Hiroshi Shimamoto
  2008-12-16 22:04 ` [PATCH 3/3] x86: ia32_signal: use proper macro __USER32_DS Hiroshi Shimamoto
@ 2008-12-16 22:06 ` Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-12-16 22:06 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel


* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> Impact: cleanup
> 
> Call signal_fault() in error route of sys_sigreturn().
> Change log level to KERN_EMERG if current is init.
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
>  arch/x86/kernel/signal.c |   15 +++------------
>  1 files changed, 3 insertions(+), 12 deletions(-)

applied your three patches to tip/x86/signal:

 8bee3f0: x86: ia32_signal: use proper macro __USER32_DS
 d0b48ca: x86: ia32_signal: use __put_user() instead of __copy_to_user()
 ae417bb: x86: signal: use signal_fault() in sys_sigreturn()

thanks!

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-16 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16 22:02 [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Hiroshi Shimamoto
2008-12-16 22:03 ` [PATCH 2/3] x86: ia32_signal: use __put_user() instead of __copy_to_user() Hiroshi Shimamoto
2008-12-16 22:04 ` [PATCH 3/3] x86: ia32_signal: use proper macro __USER32_DS Hiroshi Shimamoto
2008-12-16 22:06 ` [PATCH 1/3] x86: signal: use signal_fault() in sys_sigreturn() Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox