linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Laurent MEYER <meyerlau@fr.ibm.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH] sigaltstack bad behavior on powerpc64
Date: Mon, 27 Mar 2006 11:37:41 +0200	[thread overview]
Message-ID: <1143452261.3911.16.camel@localhost.localdomain> (raw)

[-- 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);
 	}

             reply	other threads:[~2006-03-27 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-27  9:37 Laurent MEYER [this message]
2006-03-27 13:48 ` [PATCH] sigaltstack bad behavior on powerpc64 Andreas Schwab
2006-03-27 22:20 ` Paul Mackerras

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=1143452261.3911.16.camel@localhost.localdomain \
    --to=meyerlau@fr.ibm.com \
    --cc=linuxppc-dev@ozlabs.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).