diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-09-26 02:33:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:49:07 -0400 |
commit | 4b84c69b5f6c08a540e3683f1360a6cdef2806c7 (patch) | |
tree | 708f1e4cbc2771886aaeb8eadb3ae4d458bc8133 /arch/um/os-Linux/skas/process.c | |
parent | 19bdf0409f25a85a45874a5a8da6f3e4edcf4a49 (diff) |
[PATCH] uml: Move signal handlers to arch code
Have most signals go through an arch-provided handler which recovers the
sigcontext and then calls a generic handler. This replaces the
ARCH_GET_SIGCONTEXT macro, which was somewhat fragile. On x86_64, recovering
%rdx (which holds the sigcontext pointer) must be the first thing that
happens. sig_handler duly invokes that first, but there is no guarantee that
I can see that instructions won't be reordered such that %rdx is used before
that. Having the arch provide the handler seems much more robust.
Some signals in some parts of UML require their own handlers - these places
don't call set_handler any more. They call sigaction or signal themselves.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/os-Linux/skas/process.c')
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 50418a5e7134..88ff0de95cd3 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -189,14 +189,25 @@ static int userspace_tramp(void *stack) | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | if(!ptrace_faultinfo && (stack != NULL)){ | 191 | if(!ptrace_faultinfo && (stack != NULL)){ |
192 | struct sigaction sa; | ||
193 | |||
192 | unsigned long v = UML_CONFIG_STUB_CODE + | 194 | unsigned long v = UML_CONFIG_STUB_CODE + |
193 | (unsigned long) stub_segv_handler - | 195 | (unsigned long) stub_segv_handler - |
194 | (unsigned long) &__syscall_stub_start; | 196 | (unsigned long) &__syscall_stub_start; |
195 | 197 | ||
196 | set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); | 198 | set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); |
197 | set_handler(SIGSEGV, (void *) v, SA_ONSTACK, | 199 | sigemptyset(&sa.sa_mask); |
198 | SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, | 200 | sigaddset(&sa.sa_mask, SIGIO); |
199 | SIGUSR1, -1); | 201 | sigaddset(&sa.sa_mask, SIGWINCH); |
202 | sigaddset(&sa.sa_mask, SIGALRM); | ||
203 | sigaddset(&sa.sa_mask, SIGVTALRM); | ||
204 | sigaddset(&sa.sa_mask, SIGUSR1); | ||
205 | sa.sa_flags = SA_ONSTACK; | ||
206 | sa.sa_handler = (void *) v; | ||
207 | sa.sa_restorer = NULL; | ||
208 | if(sigaction(SIGSEGV, &sa, NULL) < 0) | ||
209 | panic("userspace_tramp - setting SIGSEGV handler " | ||
210 | "failed - errno = %d\n", errno); | ||
200 | } | 211 | } |
201 | 212 | ||
202 | os_stop_process(os_getpid()); | 213 | os_stop_process(os_getpid()); |