diff options
-rw-r--r-- | arch/um/include/arch.h | 2 | ||||
-rw-r--r-- | arch/um/kernel/trap.c | 5 | ||||
-rw-r--r-- | arch/um/sys-i386/bugs.c | 46 | ||||
-rw-r--r-- | arch/um/sys-x86_64/bugs.c | 7 |
4 files changed, 24 insertions, 36 deletions
diff --git a/arch/um/include/arch.h b/arch/um/include/arch.h index 49c601ff2bac..2de92a08a76b 100644 --- a/arch/um/include/arch.h +++ b/arch/um/include/arch.h | |||
@@ -10,6 +10,6 @@ | |||
10 | 10 | ||
11 | extern void arch_check_bugs(void); | 11 | extern void arch_check_bugs(void); |
12 | extern int arch_fixup(unsigned long address, struct uml_pt_regs *regs); | 12 | extern int arch_fixup(unsigned long address, struct uml_pt_regs *regs); |
13 | extern int arch_handle_signal(int sig, struct uml_pt_regs *regs); | 13 | extern void arch_examine_signal(int sig, struct uml_pt_regs *regs); |
14 | 14 | ||
15 | #endif | 15 | #endif |
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index cb3321f8e0a9..e3a3ab8f8635 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -216,9 +216,6 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, | |||
216 | 216 | ||
217 | void relay_signal(int sig, struct uml_pt_regs *regs) | 217 | void relay_signal(int sig, struct uml_pt_regs *regs) |
218 | { | 218 | { |
219 | if (arch_handle_signal(sig, regs)) | ||
220 | return; | ||
221 | |||
222 | if (!UPT_IS_USER(regs)) { | 219 | if (!UPT_IS_USER(regs)) { |
223 | if (sig == SIGBUS) | 220 | if (sig == SIGBUS) |
224 | printk(KERN_ERR "Bus error - the host /dev/shm or /tmp " | 221 | printk(KERN_ERR "Bus error - the host /dev/shm or /tmp " |
@@ -226,6 +223,8 @@ void relay_signal(int sig, struct uml_pt_regs *regs) | |||
226 | panic("Kernel mode signal %d", sig); | 223 | panic("Kernel mode signal %d", sig); |
227 | } | 224 | } |
228 | 225 | ||
226 | arch_examine_signal(sig, regs); | ||
227 | |||
229 | current->thread.arch.faultinfo = *UPT_FAULTINFO(regs); | 228 | current->thread.arch.faultinfo = *UPT_FAULTINFO(regs); |
230 | force_sig(sig, current); | 229 | force_sig(sig, current); |
231 | } | 230 | } |
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c index fc991184850c..b0cb05228a97 100644 --- a/arch/um/sys-i386/bugs.c +++ b/arch/um/sys-i386/bugs.c | |||
@@ -3,14 +3,12 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | ||
7 | #include <signal.h> | 6 | #include <signal.h> |
8 | #include <string.h> | ||
9 | #include "kern_constants.h" | 7 | #include "kern_constants.h" |
10 | #include "os.h" | 8 | #include "longjmp.h" |
11 | #include "task.h" | 9 | #include "task.h" |
12 | #include "user.h" | 10 | #include "user.h" |
13 | #include "sysdep/archsetjmp.h" | 11 | #include "sysdep/ptrace.h" |
14 | 12 | ||
15 | /* Set during early boot */ | 13 | /* Set during early boot */ |
16 | int host_has_cmov = 1; | 14 | int host_has_cmov = 1; |
@@ -22,7 +20,7 @@ static void cmov_sigill_test_handler(int sig) | |||
22 | longjmp(cmov_test_return, 1); | 20 | longjmp(cmov_test_return, 1); |
23 | } | 21 | } |
24 | 22 | ||
25 | static void test_for_host_cmov(void) | 23 | void arch_check_bugs(void) |
26 | { | 24 | { |
27 | struct sigaction old, new; | 25 | struct sigaction old, new; |
28 | 26 | ||
@@ -44,16 +42,7 @@ static void test_for_host_cmov(void) | |||
44 | sigaction(SIGILL, &old, &new); | 42 | sigaction(SIGILL, &old, &new); |
45 | } | 43 | } |
46 | 44 | ||
47 | void arch_init_thread(void) | 45 | void arch_examine_signal(int sig, struct uml_pt_regs *regs) |
48 | { | ||
49 | } | ||
50 | |||
51 | void arch_check_bugs(void) | ||
52 | { | ||
53 | test_for_host_cmov(); | ||
54 | } | ||
55 | |||
56 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) | ||
57 | { | 46 | { |
58 | unsigned char tmp[2]; | 47 | unsigned char tmp[2]; |
59 | 48 | ||
@@ -62,20 +51,25 @@ int arch_handle_signal(int sig, struct uml_pt_regs *regs) | |||
62 | * SIGILL in init. | 51 | * SIGILL in init. |
63 | */ | 52 | */ |
64 | if ((sig != SIGILL) || (TASK_PID(get_current()) != 1)) | 53 | if ((sig != SIGILL) || (TASK_PID(get_current()) != 1)) |
65 | return 0; | 54 | return; |
55 | |||
56 | if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) { | ||
57 | printk(UM_KERN_ERR "SIGILL in init, could not read " | ||
58 | "instructions!\n"); | ||
59 | return; | ||
60 | } | ||
66 | 61 | ||
67 | if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) | ||
68 | panic("SIGILL in init, could not read instructions!\n"); | ||
69 | if ((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) | 62 | if ((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) |
70 | return 0; | 63 | return; |
71 | 64 | ||
72 | if (host_has_cmov == 0) | 65 | if (host_has_cmov == 0) |
73 | panic("SIGILL caused by cmov, which this processor doesn't " | 66 | printk(UM_KERN_ERR "SIGILL caused by cmov, which this " |
74 | "implement, boot a filesystem compiled for older " | 67 | "processor doesn't implement. Boot a filesystem " |
75 | "processors"); | 68 | "compiled for older processors"); |
76 | else if (host_has_cmov == 1) | 69 | else if (host_has_cmov == 1) |
77 | panic("SIGILL caused by cmov, which this processor claims to " | 70 | printk(UM_KERN_ERR "SIGILL caused by cmov, which this " |
78 | "implement"); | 71 | "processor claims to implement"); |
79 | else panic("Bad value for host_has_cmov (%d)", host_has_cmov); | 72 | else |
80 | return 0; | 73 | printk(UM_KERN_ERR "Bad value for host_has_cmov (%d)", |
74 | host_has_cmov); | ||
81 | } | 75 | } |
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/um/sys-x86_64/bugs.c index 506b6765bbcb..44e02ba2a265 100644 --- a/arch/um/sys-x86_64/bugs.c +++ b/arch/um/sys-x86_64/bugs.c | |||
@@ -6,15 +6,10 @@ | |||
6 | 6 | ||
7 | #include "sysdep/ptrace.h" | 7 | #include "sysdep/ptrace.h" |
8 | 8 | ||
9 | void arch_init_thread(void) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | void arch_check_bugs(void) | 9 | void arch_check_bugs(void) |
14 | { | 10 | { |
15 | } | 11 | } |
16 | 12 | ||
17 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) | 13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs) |
18 | { | 14 | { |
19 | return 0; | ||
20 | } | 15 | } |