Re: [PATCH 2.5.73] Signal stack fixes #1 introduce PF_SS_ACTIVE

Paul Mackerras (paulus@samba.org)
Sat, 5 Jul 2003 09:18:21 +1000


Jörn Engel writes:

> This should be the ppc specific part of the signal stack fixes. It sets the
> flag, when switching to the signal stack and clears it, when switching
> back. When the kernel tries to switch to the signal stack again,
> without switching back, the process screwed up the signal stack, so we
> kill it with a SIGSEGV.

This is madness.

There is nothing in POSIX that says that you have to exit a signal
handler by returning from it (which, under Linux, ends up doing a
sigreturn or rt_sigreturn system call). It is explicitly permitted to
return from a RT signal handler with setcontext(), for instance. And
it is at least long-standing practice to return using longjmp().
Neither setcontext nor longjmp will do a system call (yes, setcontext
is a system call on sparc, but it isn't on x86 AFAIK).

So - the kernel doesn't (and can't and shouldn't need to) know about
all transitions to or from a signal stack. Therefore the PF_SS_ACTIVE
bit is useless since it will be wrong some of the time.

Anyway, what is the problem with taking a signal on the signal stack
when you in a signal handler using the signal stack? You just keep
going down the stack from where you are, which is what the code
already does.

BTW, I am the PPC maintainer; Ben is the powermac maintainer.

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