Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] powerpc: fix incorrect SA_ONSTACK behaviour for 64-bit processes

*) 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@fr.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Laurent MEYER and committed by
Paul Mackerras
11089f08 5149fa47

+1 -1
+1 -1
arch/powerpc/kernel/signal_64.c
··· 212 212 /* Default to using normal stack */ 213 213 newsp = regs->gpr[1]; 214 214 215 - if (ka->sa.sa_flags & SA_ONSTACK) { 215 + if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size) { 216 216 if (! on_sig_stack(regs->gpr[1])) 217 217 newsp = (current->sas_ss_sp + current->sas_ss_size); 218 218 }