mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent MEYER <meyerlau@fr.ibm.com>
To: Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>
Subject: Re: [patch 02/22] powerpc: fix incorrect SA_ONSTACK behaviour for 64-bit processes
Date: Mon, 24 Apr 2006 10:27:45 +0200	[thread overview]
Message-ID: <1145867270.4022.12.camel@donkey.lab.meiosys.com> (raw)
In-Reply-To: <20060413230659.GC5613@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]



> -stable review patch.  If anyone has any objections, please let us know.
> ------------------
> From: Laurent MEYER <meyerlau@fr.ibm.com>
> 
> *) When setting a sighandler using sigaction() call, if the flag
> SA_ONSTACK is set and no alternate stack is provided via sigaltstack(),
> the kernel still try to install the alternate stack. This behavior is
> the opposite of the one which is documented in Single Unix
> Specifications V3.
> 
> *) Also when setting an alternate stack using sigaltstack() with the
> flag SS_DISABLE, the kernel try to install the alternate stack on
> signal delivery.
> 
> These two use cases makes the process crash at signal delivery.
> 
> This fixes it.
> 


As we got the bug on powerpc64 and s390 i checked others architecture,
and the same bug seems to appear on arch: 
- alpha
- frv
- h8300
- m68knommu
- m68k
- parisc
- sh64
- v850
- xtensa

Please find enclosed the patch that fixes it. Forgive me i have not
tested this patch as i don't have all the corresponding machines. But
the bug seems to be quite the same.

Regards

Signed-off-by: Laurent Meyer <meyerlau@fr.ibm.com>


[-- Attachment #2: multiarch.sigaltstack.patch --]
[-- Type: text/x-patch, Size: 5279 bytes --]

Index: 2.6.16.5/arch/alpha/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/alpha/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/alpha/kernel/signal.c	2006-04-17 15:17:58.000000000 +0200
@@ -375,7 +375,7 @@
 static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
 	return (void __user *)((sp - frame_size) & -32ul);
Index: 2.6.16.5/arch/frv/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/frv/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/frv/kernel/signal.c	2006-04-17 15:25:01.000000000 +0200
@@ -233,7 +233,7 @@
 
 	/* This is the X/Open sanctioned signal stack switching.  */
 	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (! on_sig_stack(sp))
+		if (! sas_ss_flags(sp))
 			sp = current->sas_ss_sp + current->sas_ss_size;
 	}
 
Index: 2.6.16.5/arch/h8300/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/h8300/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/h8300/kernel/signal.c	2006-04-17 15:35:15.000000000 +0200
@@ -307,7 +307,7 @@
 
 	/* This is the X/Open sanctioned signal stack switching.  */
 	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (!on_sig_stack(usp))
+		if (!sas_ss_flags(usp))
 			usp = current->sas_ss_sp + current->sas_ss_size;
 	}
 	return (void *)((usp - frame_size) & -8UL);
Index: 2.6.16.5/arch/m68knommu/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/m68knommu/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/m68knommu/kernel/signal.c	2006-04-17 15:46:30.000000000 +0200
@@ -553,7 +553,7 @@
 
 	/* This is the X/Open sanctioned signal stack switching.  */
 	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (!on_sig_stack(usp))
+		if (!sas_ss_flags(usp))
 			usp = current->sas_ss_sp + current->sas_ss_size;
 	}
 	return (void *)((usp - frame_size) & -8UL);
Index: 2.6.16.5/arch/m68k/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/m68k/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/m68k/kernel/signal.c	2006-04-17 15:42:20.000000000 +0200
@@ -763,7 +763,7 @@
 
 	/* This is the X/Open sanctioned signal stack switching.  */
 	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (!on_sig_stack(usp))
+		if (!sas_ss_flags(usp))
 			usp = current->sas_ss_sp + current->sas_ss_size;
 	}
 	return (void __user *)((usp - frame_size) & -8UL);
Index: 2.6.16.5/arch/parisc/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/parisc/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/parisc/kernel/signal.c	2006-04-17 15:55:13.000000000 +0200
@@ -248,7 +248,7 @@
 	DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n",
 			(unsigned long)ka, sp, frame_size);
 	
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
 		sp = current->sas_ss_sp; /* Stacks grow up! */
 
 	DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp);
Index: 2.6.16.5/arch/sh64/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/sh64/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/sh64/kernel/signal.c	2006-04-17 16:02:30.000000000 +0200
@@ -407,7 +407,7 @@
 static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
 	return (void __user *)((sp - frame_size) & -8ul);
Index: 2.6.16.5/arch/v850/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/v850/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/v850/kernel/signal.c	2006-04-17 16:11:25.000000000 +0200
@@ -274,7 +274,7 @@
 	/* Default to using normal stack */
 	unsigned long sp = regs->gpr[GPR_SP];
 
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
 	return (void *)((sp - frame_size) & -8UL);
Index: 2.6.16.5/arch/xtensa/kernel/signal.c
===================================================================
--- 2.6.16.5.orig/arch/xtensa/kernel/signal.c	2006-03-20 06:53:29.000000000 +0100
+++ 2.6.16.5/arch/xtensa/kernel/signal.c	2006-04-17 16:16:40.000000000 +0200
@@ -433,7 +433,7 @@
 static inline void *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
 	return (void *)((sp - frame_size) & -16ul);


  reply	other threads:[~2006-04-24  8:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060413230141.330705000@quad.kroah.org>
2006-04-13 23:06 ` [patch 00/22] -stable review Greg KH
2006-04-13 23:06   ` [patch 01/22] powerpc: iSeries needs slb_initialize to be called Greg KH
2006-04-13 23:06   ` [patch 02/22] powerpc: fix incorrect SA_ONSTACK behaviour for 64-bit processes Greg KH
2006-04-24  8:27     ` Laurent MEYER [this message]
2006-04-13 23:07   ` [patch 03/22] MPBL0010 driver sysfs permissions wide open Greg KH
2006-04-13 23:07   ` [patch 04/22] isd200: limit to BLK_DEV_IDE Greg KH
2006-04-14  1:58     ` Jeff Garzik
2006-04-15 11:51       ` Adrian Bunk
2006-04-13 23:07   ` [patch 05/22] sky2: bad memory reference on dual port cards Greg KH
2006-04-13 23:07   ` [patch 06/22] NETFILTER: Fix fragmentation issues with bridge netfilter Greg KH
2006-04-13 23:07   ` [patch 07/22] m32r: security fix of {get, put}_user macros Greg KH
2006-04-13 23:07   ` [patch 08/22] m32r: Fix cpu_possible_map and cpu_present_map initialization for SMP kernel Greg KH
2006-04-13 23:07   ` [patch 09/22] fuse: fix oops in fuse_send_readpages() Greg KH
2006-04-13 23:07   ` [patch 10/22] Fix buddy list race that could lead to page lru list corruptions Greg KH
2006-04-13 23:08   ` [patch 11/22] Fix block device symlink name Greg KH
2006-04-14  0:57     ` Christoph Hellwig
2006-04-14 19:48       ` [stable] " Greg KH
2006-04-13 23:08   ` [patch 12/22] ext3: Fix missed mutex unlock Greg KH
2006-04-13 23:08   ` [patch 13/22] edac_752x needs CONFIG_HOTPLUG Greg KH
2006-04-13 23:25     ` Dave Peterson
2006-04-13 23:44       ` Greg KH
2006-04-13 23:08   ` [patch 14/22] cciss: bug fix for crash when running hpacucli Greg KH
2006-04-13 23:08   ` [patch 15/22] alpha: SMP boot fixes Greg KH
2006-04-13 23:09   ` [patch 16/22] Fix utime(2) in the case that no times parameter was passed in Greg KH
2006-04-13 23:09   ` [patch 17/22] RLIMIT_CPU: fix handling of a zero limit Greg KH
2006-04-13 23:09   ` [patch 18/22] Incorrect signature sent on SMB Read Greg KH
2006-04-13 23:09   ` [patch 19/22] Fix suspend with traced tasks Greg KH
2006-04-13 23:09   ` [patch 20/22] USB: remove __init from usb_console_setup Greg KH
2006-04-13 23:09   ` [patch 21/22] fix non-leader exec under ptrace Greg KH
2006-04-14 18:52     ` Andrea Arcangeli
2006-04-13 23:09   ` [patch 22/22] atm: clip causes unregister hang Greg KH

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=1145867270.4022.12.camel@donkey.lab.meiosys.com \
    --to=meyerlau@fr.ibm.com \
    --cc=gregkh@suse.de \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome