diff options
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/exec.c | 25 | ||||
-rw-r--r-- | arch/um/kernel/process.c | 8 | ||||
-rw-r--r-- | arch/um/kernel/signal.c | 6 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 24 |
4 files changed, 27 insertions, 36 deletions
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 6cade9366364..8c82786da823 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -39,34 +39,21 @@ void flush_thread(void) | |||
39 | 39 | ||
40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | 40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) |
41 | { | 41 | { |
42 | get_safe_registers(regs->regs.gp, regs->regs.fp); | ||
42 | PT_REGS_IP(regs) = eip; | 43 | PT_REGS_IP(regs) = eip; |
43 | PT_REGS_SP(regs) = esp; | 44 | PT_REGS_SP(regs) = esp; |
44 | } | 45 | current->ptrace &= ~PT_DTRACE; |
45 | EXPORT_SYMBOL(start_thread); | ||
46 | |||
47 | static long execve1(const char *file, | ||
48 | const char __user *const __user *argv, | ||
49 | const char __user *const __user *env) | ||
50 | { | ||
51 | long error; | ||
52 | |||
53 | error = do_execve(file, argv, env, ¤t->thread.regs); | ||
54 | if (error == 0) { | ||
55 | task_lock(current); | ||
56 | current->ptrace &= ~PT_DTRACE; | ||
57 | #ifdef SUBARCH_EXECVE1 | 46 | #ifdef SUBARCH_EXECVE1 |
58 | SUBARCH_EXECVE1(¤t->thread.regs.regs); | 47 | SUBARCH_EXECVE1(regs->regs); |
59 | #endif | 48 | #endif |
60 | task_unlock(current); | ||
61 | } | ||
62 | return error; | ||
63 | } | 49 | } |
50 | EXPORT_SYMBOL(start_thread); | ||
64 | 51 | ||
65 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) | 52 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) |
66 | { | 53 | { |
67 | long err; | 54 | long err; |
68 | 55 | ||
69 | err = execve1(file, argv, env); | 56 | err = do_execve(file, argv, env, ¤t->thread.regs); |
70 | if (!err) | 57 | if (!err) |
71 | UML_LONGJMP(current->thread.exec_buf, 1); | 58 | UML_LONGJMP(current->thread.exec_buf, 1); |
72 | return err; | 59 | return err; |
@@ -81,7 +68,7 @@ long sys_execve(const char __user *file, const char __user *const __user *argv, | |||
81 | filename = getname(file); | 68 | filename = getname(file); |
82 | error = PTR_ERR(filename); | 69 | error = PTR_ERR(filename); |
83 | if (IS_ERR(filename)) goto out; | 70 | if (IS_ERR(filename)) goto out; |
84 | error = execve1(filename, argv, env); | 71 | error = do_execve(filename, argv, env, ¤t->thread.regs); |
85 | putname(filename); | 72 | putname(filename); |
86 | out: | 73 | out: |
87 | return error; | 74 | return error; |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 57fc7028714a..c5f5afa50745 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -181,11 +181,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
181 | struct pt_regs *regs) | 181 | struct pt_regs *regs) |
182 | { | 182 | { |
183 | void (*handler)(void); | 183 | void (*handler)(void); |
184 | int kthread = current->flags & PF_KTHREAD; | ||
184 | int ret = 0; | 185 | int ret = 0; |
185 | 186 | ||
186 | p->thread = (struct thread_struct) INIT_THREAD; | 187 | p->thread = (struct thread_struct) INIT_THREAD; |
187 | 188 | ||
188 | if (current->thread.forking) { | 189 | if (!kthread) { |
189 | memcpy(&p->thread.regs.regs, ®s->regs, | 190 | memcpy(&p->thread.regs.regs, ®s->regs, |
190 | sizeof(p->thread.regs.regs)); | 191 | sizeof(p->thread.regs.regs)); |
191 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); | 192 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); |
@@ -195,8 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
195 | handler = fork_handler; | 196 | handler = fork_handler; |
196 | 197 | ||
197 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | 198 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
198 | } | 199 | } else { |
199 | else { | ||
200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); | 200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); |
201 | p->thread.request.u.thread = current->thread.request.u.thread; | 201 | p->thread.request.u.thread = current->thread.request.u.thread; |
202 | handler = new_thread_handler; | 202 | handler = new_thread_handler; |
@@ -204,7 +204,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
204 | 204 | ||
205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); | 205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); |
206 | 206 | ||
207 | if (current->thread.forking) { | 207 | if (!kthread) { |
208 | clear_flushed_tls(p); | 208 | clear_flushed_tls(p); |
209 | 209 | ||
210 | /* | 210 | /* |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 7362d58efc29..cc9c2350e417 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -22,9 +22,13 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
22 | struct k_sigaction *ka, siginfo_t *info) | 22 | struct k_sigaction *ka, siginfo_t *info) |
23 | { | 23 | { |
24 | sigset_t *oldset = sigmask_to_save(); | 24 | sigset_t *oldset = sigmask_to_save(); |
25 | int singlestep = 0; | ||
25 | unsigned long sp; | 26 | unsigned long sp; |
26 | int err; | 27 | int err; |
27 | 28 | ||
29 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
30 | singlestep = 1; | ||
31 | |||
28 | /* Did we come from a system call? */ | 32 | /* Did we come from a system call? */ |
29 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { | 33 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { |
30 | /* If so, check system call restarting.. */ | 34 | /* If so, check system call restarting.. */ |
@@ -61,7 +65,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
61 | if (err) | 65 | if (err) |
62 | force_sigsegv(signr, current); | 66 | force_sigsegv(signr, current); |
63 | else | 67 | else |
64 | signal_delivered(signr, info, ka, regs, 0); | 68 | signal_delivered(signr, info, ka, regs, singlestep); |
65 | } | 69 | } |
66 | 70 | ||
67 | static int kern_do_signal(struct pt_regs *regs) | 71 | static int kern_do_signal(struct pt_regs *regs) |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index f958cb876ee3..a4c6d8eee74c 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -17,25 +17,25 @@ | |||
17 | 17 | ||
18 | long sys_fork(void) | 18 | long sys_fork(void) |
19 | { | 19 | { |
20 | long ret; | 20 | return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
21 | |||
22 | current->thread.forking = 1; | ||
23 | ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), | ||
24 | ¤t->thread.regs, 0, NULL, NULL); | 21 | ¤t->thread.regs, 0, NULL, NULL); |
25 | current->thread.forking = 0; | ||
26 | return ret; | ||
27 | } | 22 | } |
28 | 23 | ||
29 | long sys_vfork(void) | 24 | long sys_vfork(void) |
30 | { | 25 | { |
31 | long ret; | 26 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
32 | |||
33 | current->thread.forking = 1; | ||
34 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | ||
35 | UPT_SP(¤t->thread.regs.regs), | 27 | UPT_SP(¤t->thread.regs.regs), |
36 | ¤t->thread.regs, 0, NULL, NULL); | 28 | ¤t->thread.regs, 0, NULL, NULL); |
37 | current->thread.forking = 0; | 29 | } |
38 | return ret; | 30 | |
31 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
32 | void __user *parent_tid, void __user *child_tid) | ||
33 | { | ||
34 | if (!newsp) | ||
35 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
36 | |||
37 | return do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
38 | child_tid); | ||
39 | } | 39 | } |
40 | 40 | ||
41 | long old_mmap(unsigned long addr, unsigned long len, | 41 | long old_mmap(unsigned long addr, unsigned long len, |