Possible bug in sigaltstack handling (with patch)

Patrick J. LoPresti (patl@cag.lcs.mit.edu)
02 Nov 1999 20:17:36 -0500


This is in kernel 2.2.13.

The function do_sigaltstack() in kernel/signal.c, when invoked with
the SS_DISABLE flag, sets the fields sas_ss_sp and sas_ss_size to zero
in the current task struct.

The get_sigframe function in arch/i386/kernel/signal.c checks the
SA_ONSTACK flag in the sigaction structure and, if it is set, attempts
to deliver the signal onto the alternate signal stack. If there is no
alternate signal stack, this will try to deliver the signal onto a
"stack" at the top of memory, which strikes me as rather unfriendly.

I do not know what the X/Open standard says about this, but it seems
to me that it would be nicer to ignore the SA_ONSTACK flag when no
alternate signal stack has been set. The does patch does this;
architectures other than i386 probably need something similar.

- Pat

--- arch/i386/kernel/signal.c~ Mon Jun 7 19:14:20 1999
+++ arch/i386/kernel/signal.c Tue Nov 2 19:55:05 1999
@@ -388,7 +388,7 @@

/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (! on_sig_stack(esp))
+ if (current->sas_ss_size && ! on_sig_stack(esp))
esp = 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@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/