[patch 02/22] powerpc: fix incorrect SA_ONSTACK behaviour for 64-bit processes

From: Greg KH
Date: Thu Apr 13 2006 - 19:08:34 EST


-stable review patch. If anyone has any objections, please let us know.

------------------
From: Laurent MEYER <meyerlau@xxxxxxxxxx>

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

Signed-off-by: Laurent Meyer <meyerlau@xxxxxxxxxx>
Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
arch/powerpc/kernel/signal_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.16.5.orig/arch/powerpc/kernel/signal_64.c
+++ linux-2.6.16.5/arch/powerpc/kernel/signal_64.c
@@ -213,7 +213,7 @@ static inline void __user * get_sigframe
/* 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);
}

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/