diff options
Diffstat (limited to 'arch/um/os-Linux/skas/process.c')
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 7baf90fda58b..42e3d1ed802c 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | #include <errno.h> | 9 | #include <errno.h> |
10 | #include <signal.h> | 10 | #include <signal.h> |
11 | #include <setjmp.h> | ||
12 | #include <sched.h> | 11 | #include <sched.h> |
13 | #include "ptrace_user.h" | 12 | #include "ptrace_user.h" |
14 | #include <sys/wait.h> | 13 | #include <sys/wait.h> |
@@ -156,11 +155,15 @@ extern int __syscall_stub_start; | |||
156 | static int userspace_tramp(void *stack) | 155 | static int userspace_tramp(void *stack) |
157 | { | 156 | { |
158 | void *addr; | 157 | void *addr; |
158 | int err; | ||
159 | 159 | ||
160 | ptrace(PTRACE_TRACEME, 0, 0, 0); | 160 | ptrace(PTRACE_TRACEME, 0, 0, 0); |
161 | 161 | ||
162 | init_new_thread_signals(); | 162 | init_new_thread_signals(); |
163 | enable_timer(); | 163 | err = set_interval(1); |
164 | if(err) | ||
165 | panic("userspace_tramp - setting timer failed, errno = %d\n", | ||
166 | err); | ||
164 | 167 | ||
165 | if(!proc_mm){ | 168 | if(!proc_mm){ |
166 | /* This has a pte, but it can't be mapped in with the usual | 169 | /* This has a pte, but it can't be mapped in with the usual |
@@ -190,14 +193,25 @@ static int userspace_tramp(void *stack) | |||
190 | } | 193 | } |
191 | } | 194 | } |
192 | if(!ptrace_faultinfo && (stack != NULL)){ | 195 | if(!ptrace_faultinfo && (stack != NULL)){ |
196 | struct sigaction sa; | ||
197 | |||
193 | unsigned long v = UML_CONFIG_STUB_CODE + | 198 | unsigned long v = UML_CONFIG_STUB_CODE + |
194 | (unsigned long) stub_segv_handler - | 199 | (unsigned long) stub_segv_handler - |
195 | (unsigned long) &__syscall_stub_start; | 200 | (unsigned long) &__syscall_stub_start; |
196 | 201 | ||
197 | set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); | 202 | set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); |
198 | set_handler(SIGSEGV, (void *) v, SA_ONSTACK, | 203 | sigemptyset(&sa.sa_mask); |
199 | SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, | 204 | sigaddset(&sa.sa_mask, SIGIO); |
200 | SIGUSR1, -1); | 205 | sigaddset(&sa.sa_mask, SIGWINCH); |
206 | sigaddset(&sa.sa_mask, SIGALRM); | ||
207 | sigaddset(&sa.sa_mask, SIGVTALRM); | ||
208 | sigaddset(&sa.sa_mask, SIGUSR1); | ||
209 | sa.sa_flags = SA_ONSTACK; | ||
210 | sa.sa_handler = (void *) v; | ||
211 | sa.sa_restorer = NULL; | ||
212 | if(sigaction(SIGSEGV, &sa, NULL) < 0) | ||
213 | panic("userspace_tramp - setting SIGSEGV handler " | ||
214 | "failed - errno = %d\n", errno); | ||
201 | } | 215 | } |
202 | 216 | ||
203 | os_stop_process(os_getpid()); | 217 | os_stop_process(os_getpid()); |
@@ -470,7 +484,7 @@ void thread_wait(void *sw, void *fb) | |||
470 | *switch_buf = &buf; | 484 | *switch_buf = &buf; |
471 | fork_buf = fb; | 485 | fork_buf = fb; |
472 | if(UML_SETJMP(&buf) == 0) | 486 | if(UML_SETJMP(&buf) == 0) |
473 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); | 487 | UML_LONGJMP(fork_buf, INIT_JMP_REMOVE_SIGSTACK); |
474 | } | 488 | } |
475 | 489 | ||
476 | void switch_threads(void *me, void *next) | 490 | void switch_threads(void *me, void *next) |