diff options
-rw-r--r-- | arch/i386/kernel/signal.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/traps.c | 5 | ||||
-rw-r--r-- | include/asm-i386/ptrace.h | 7 |
3 files changed, 11 insertions, 5 deletions
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c index 7bcda6d69d87..61eb0c8a6e47 100644 --- a/arch/i386/kernel/signal.c +++ b/arch/i386/kernel/signal.c | |||
@@ -604,7 +604,9 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
604 | * We want the common case to go fast, which | 604 | * We want the common case to go fast, which |
605 | * is why we may in certain cases get here from | 605 | * is why we may in certain cases get here from |
606 | * kernel mode. Just return without doing anything | 606 | * kernel mode. Just return without doing anything |
607 | * if so. | 607 | * if so. vm86 regs switched out by assembly code |
608 | * before reaching here, so testing against kernel | ||
609 | * CS suffices. | ||
608 | */ | 610 | */ |
609 | if (!user_mode(regs)) | 611 | if (!user_mode(regs)) |
610 | return 1; | 612 | return 1; |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 1144df0c48d6..b2b4bb890bb7 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -210,7 +210,7 @@ void show_registers(struct pt_regs *regs) | |||
210 | unsigned short ss; | 210 | unsigned short ss; |
211 | 211 | ||
212 | esp = (unsigned long) (®s->esp); | 212 | esp = (unsigned long) (®s->esp); |
213 | ss = __KERNEL_DS; | 213 | savesegment(ss, ss); |
214 | if (user_mode(regs)) { | 214 | if (user_mode(regs)) { |
215 | in_kernel = 0; | 215 | in_kernel = 0; |
216 | esp = regs->esp; | 216 | esp = regs->esp; |
@@ -267,9 +267,6 @@ static void handle_BUG(struct pt_regs *regs) | |||
267 | char c; | 267 | char c; |
268 | unsigned long eip; | 268 | unsigned long eip; |
269 | 269 | ||
270 | if (user_mode(regs)) | ||
271 | goto no_bug; /* Not in kernel */ | ||
272 | |||
273 | eip = regs->eip; | 270 | eip = regs->eip; |
274 | 271 | ||
275 | if (eip < PAGE_OFFSET) | 272 | if (eip < PAGE_OFFSET) |
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 05532875e39e..7e0f2945d17d 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h | |||
@@ -61,6 +61,13 @@ struct pt_regs { | |||
61 | struct task_struct; | 61 | struct task_struct; |
62 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); | 62 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); |
63 | 63 | ||
64 | /* | ||
65 | * user_mode_vm(regs) determines whether a register set came from user mode. | ||
66 | * This is true if V8086 mode was enabled OR if the register set was from | ||
67 | * protected mode with RPL-3 CS value. This tricky test checks that with | ||
68 | * one comparison. Many places in the kernel can bypass this full check | ||
69 | * if they have already ruled out V8086 mode, so user_mode(regs) can be used. | ||
70 | */ | ||
64 | static inline int user_mode(struct pt_regs *regs) | 71 | static inline int user_mode(struct pt_regs *regs) |
65 | { | 72 | { |
66 | return (regs->xcs & 3) != 0; | 73 | return (regs->xcs & 3) != 0; |