diff options
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/skas/mmu.c | 5 | ||||
-rw-r--r-- | arch/um/kernel/skas/process.c | 20 | ||||
-rw-r--r-- | arch/um/kernel/trap.c | 12 |
3 files changed, 33 insertions, 4 deletions
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index b56fe8b67a81..6da9ab4f5a18 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -114,6 +114,11 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
114 | to_mm->id.u.pid = copy_context_skas0(stack, | 114 | to_mm->id.u.pid = copy_context_skas0(stack, |
115 | from_mm->id.u.pid); | 115 | from_mm->id.u.pid); |
116 | else to_mm->id.u.pid = start_userspace(stack); | 116 | else to_mm->id.u.pid = start_userspace(stack); |
117 | |||
118 | if (to_mm->id.u.pid < 0) { | ||
119 | ret = to_mm->id.u.pid; | ||
120 | goto out_free; | ||
121 | } | ||
117 | } | 122 | } |
118 | 123 | ||
119 | ret = init_new_ldt(to_mm, from_mm); | 124 | ret = init_new_ldt(to_mm, from_mm); |
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index fce389c2342f..2e9852c0d487 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -6,19 +6,25 @@ | |||
6 | #include "linux/init.h" | 6 | #include "linux/init.h" |
7 | #include "linux/sched.h" | 7 | #include "linux/sched.h" |
8 | #include "as-layout.h" | 8 | #include "as-layout.h" |
9 | #include "kern.h" | ||
9 | #include "os.h" | 10 | #include "os.h" |
10 | #include "skas.h" | 11 | #include "skas.h" |
11 | 12 | ||
12 | int new_mm(unsigned long stack) | 13 | int new_mm(unsigned long stack) |
13 | { | 14 | { |
14 | int fd; | 15 | int fd, err; |
15 | 16 | ||
16 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); | 17 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); |
17 | if (fd < 0) | 18 | if (fd < 0) |
18 | return fd; | 19 | return fd; |
19 | 20 | ||
20 | if (skas_needs_stub) | 21 | if (skas_needs_stub) { |
21 | map_stub_pages(fd, STUB_CODE, STUB_DATA, stack); | 22 | err = map_stub_pages(fd, STUB_CODE, STUB_DATA, stack); |
23 | if (err) { | ||
24 | os_close_file(fd); | ||
25 | return err; | ||
26 | } | ||
27 | } | ||
22 | 28 | ||
23 | return fd; | 29 | return fd; |
24 | } | 30 | } |
@@ -49,8 +55,14 @@ int __init start_uml(void) | |||
49 | { | 55 | { |
50 | stack_protections((unsigned long) &cpu0_irqstack); | 56 | stack_protections((unsigned long) &cpu0_irqstack); |
51 | set_sigstack(cpu0_irqstack, THREAD_SIZE); | 57 | set_sigstack(cpu0_irqstack, THREAD_SIZE); |
52 | if (proc_mm) | 58 | if (proc_mm) { |
53 | userspace_pid[0] = start_userspace(0); | 59 | userspace_pid[0] = start_userspace(0); |
60 | if (userspace_pid[0] < 0) { | ||
61 | printf("start_uml - start_userspace returned %d\n", | ||
62 | userspace_pid[0]); | ||
63 | exit(1); | ||
64 | } | ||
65 | } | ||
54 | 66 | ||
55 | init_new_thread_signals(); | 67 | init_new_thread_signals(); |
56 | 68 | ||
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 8fd1a797c3eb..44e490419495 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -129,6 +129,18 @@ static void bad_segv(struct faultinfo fi, unsigned long ip) | |||
129 | force_sig_info(SIGSEGV, &si, current); | 129 | force_sig_info(SIGSEGV, &si, current); |
130 | } | 130 | } |
131 | 131 | ||
132 | void fatal_sigsegv(void) | ||
133 | { | ||
134 | force_sigsegv(SIGSEGV, current); | ||
135 | do_signal(); | ||
136 | /* | ||
137 | * This is to tell gcc that we're not returning - do_signal | ||
138 | * can, in general, return, but in this case, it's not, since | ||
139 | * we just got a fatal SIGSEGV queued. | ||
140 | */ | ||
141 | os_dump_core(); | ||
142 | } | ||
143 | |||
132 | void segv_handler(int sig, struct uml_pt_regs *regs) | 144 | void segv_handler(int sig, struct uml_pt_regs *regs) |
133 | { | 145 | { |
134 | struct faultinfo * fi = UPT_FAULTINFO(regs); | 146 | struct faultinfo * fi = UPT_FAULTINFO(regs); |