Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6984
b: refs/heads/master
c: 0998e42
h: refs/heads/master
v: v3
  • Loading branch information
Zachary Amsden authored and Linus Torvalds committed Sep 5, 2005
1 parent 0026af6 commit f482a40
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2ab4461249df85b20930a7a57b54f39c5ae291a
refs/heads/master: 0998e4228aca046fbd747c3fed909791d52e88eb
4 changes: 3 additions & 1 deletion trunk/arch/i386/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset)
* We want the common case to go fast, which
* is why we may in certain cases get here from
* kernel mode. Just return without doing anything
* if so.
* if so. vm86 regs switched out by assembly code
* before reaching here, so testing against kernel
* CS suffices.
*/
if (!user_mode(regs))
return 1;
Expand Down
5 changes: 1 addition & 4 deletions trunk/arch/i386/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void show_registers(struct pt_regs *regs)
unsigned short ss;

esp = (unsigned long) (&regs->esp);
ss = __KERNEL_DS;
savesegment(ss, ss);
if (user_mode(regs)) {
in_kernel = 0;
esp = regs->esp;
Expand Down Expand Up @@ -267,9 +267,6 @@ static void handle_BUG(struct pt_regs *regs)
char c;
unsigned long eip;

if (user_mode(regs))
goto no_bug; /* Not in kernel */

eip = regs->eip;

if (eip < PAGE_OFFSET)
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/asm-i386/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ struct pt_regs {
struct task_struct;
extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);

/*
* user_mode_vm(regs) determines whether a register set came from user mode.
* This is true if V8086 mode was enabled OR if the register set was from
* protected mode with RPL-3 CS value. This tricky test checks that with
* one comparison. Many places in the kernel can bypass this full check
* if they have already ruled out V8086 mode, so user_mode(regs) can be used.
*/
static inline int user_mode(struct pt_regs *regs)
{
return (regs->xcs & 3) != 0;
Expand Down

0 comments on commit f482a40

Please sign in to comment.