diff options
author | Andi Kleen | 2006-07-28 14:44:42 +0200 |
---|---|---|
committer | Linus Torvalds | 2006-07-29 04:28:00 +0200 |
commit | d5a2601734bcc740ee78dc4cb0c56b5687da7bd9 (patch) | |
tree | 42146e7eda57909a475ad69cee5cacbf39033cff /arch/i386 | |
parent | Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6 (diff) | |
download | kernel-qcow2-linux-d5a2601734bcc740ee78dc4cb0c56b5687da7bd9.tar.gz kernel-qcow2-linux-d5a2601734bcc740ee78dc4cb0c56b5687da7bd9.tar.xz kernel-qcow2-linux-d5a2601734bcc740ee78dc4cb0c56b5687da7bd9.zip |
[PATCH] i386/x86-64: Add user_mode checks to profile_pc for oprofile
Fixes a obscure user space triggerable crash during oprofiling.
Oprofile calls profile_pc from NMIs even when user_mode(regs) is not true and
the program counter is inside the kernel lock section. This opens
a race - when a user program jumps to a kernel lock address and
a NMI happens before the illegal page fault exception is raised
and the program has a unmapped esp or ebp then the kernel could
oops. NMIs have a higher priority than exceptions so that could
happen.
Add user_mode checks to i386/x86-64 profile_pc to prevent that.
Cc: John Levon <levon@movementarian.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 8705c0f05788..edd00f6cee37 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c @@ -135,7 +135,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (in_lock_functions(pc)) + if (!user_mode_vm(regs) && in_lock_functions(pc)) return *(unsigned long *)(regs->ebp + 4); return pc; |