linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sigaltstack bad behavior on powerpc64
@ 2006-03-27  9:37 Laurent MEYER
  2006-03-27 13:48 ` Andreas Schwab
  2006-03-27 22:20 ` Paul Mackerras
  0 siblings, 2 replies; 3+ messages in thread
From: Laurent MEYER @ 2006-03-27  9:37 UTC (permalink / raw)
  To: linuxppc-dev

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

Hello,

I may have found a bug in powerpc64 arch specific code.

*) 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.

I wrote a small patch to add a condition in get_sigframe().

Hope that is relevant and helpfull.

Regards,
Laurent MEYER.

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

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

Index: linux-2.6.16-mcr/arch/powerpc/kernel/signal_64.c
===================================================================
--- linux-2.6.16-mcr.orig/arch/powerpc/kernel/signal_64.c	2006-03-27 11:09:02.000000000 +0200
+++ linux-2.6.16-mcr/arch/powerpc/kernel/signal_64.c	2006-03-27 11:14:16.986879573 +0200
@@ -213,7 +213,7 @@
         /* Default to using normal stack */
         newsp = regs->gpr[1];
 
-	if (ka->sa.sa_flags & SA_ONSTACK) {
+	if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size) {
 		if (! on_sig_stack(regs->gpr[1]))
 			newsp = (current->sas_ss_sp + current->sas_ss_size);
 	}

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

* Re: [PATCH] sigaltstack bad behavior on powerpc64
  2006-03-27  9:37 [PATCH] sigaltstack bad behavior on powerpc64 Laurent MEYER
@ 2006-03-27 13:48 ` Andreas Schwab
  2006-03-27 22:20 ` Paul Mackerras
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2006-03-27 13:48 UTC (permalink / raw)
  To: Laurent MEYER; +Cc: linuxppc-dev

Laurent MEYER <meyerlau@fr.ibm.com> writes:

> Index: linux-2.6.16-mcr/arch/powerpc/kernel/signal_64.c
> ===================================================================
> --- linux-2.6.16-mcr.orig/arch/powerpc/kernel/signal_64.c	2006-03-27 11:09:02.000000000 +0200
> +++ linux-2.6.16-mcr/arch/powerpc/kernel/signal_64.c	2006-03-27 11:14:16.986879573 +0200
> @@ -213,7 +213,7 @@
>          /* Default to using normal stack */
>          newsp = regs->gpr[1];
>  
> -	if (ka->sa.sa_flags & SA_ONSTACK) {
> +	if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size) {
>  		if (! on_sig_stack(regs->gpr[1]))

This should use sas_ss_flags.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH] sigaltstack bad behavior on powerpc64
  2006-03-27  9:37 [PATCH] sigaltstack bad behavior on powerpc64 Laurent MEYER
  2006-03-27 13:48 ` Andreas Schwab
@ 2006-03-27 22:20 ` Paul Mackerras
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2006-03-27 22:20 UTC (permalink / raw)
  To: Laurent MEYER; +Cc: linuxppc-dev, olh

Laurent MEYER writes:

> I may have found a bug in powerpc64 arch specific code.

Yes, you're right, it's a bug.

> I wrote a small patch to add a condition in get_sigframe().

Looks correct.  Thanks.  I'll put it in.

Paul.

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

end of thread, other threads:[~2006-03-27 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27  9:37 [PATCH] sigaltstack bad behavior on powerpc64 Laurent MEYER
2006-03-27 13:48 ` Andreas Schwab
2006-03-27 22:20 ` Paul Mackerras

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).