diff options
author | Zachary Amsden <zach@vmware.com> | 2007-02-13 12:26:21 (GMT) |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-02-13 12:26:21 (GMT) |
commit | 7b3552024380f306a6c50d5105d18d9d4258fa4e (patch) | |
tree | 904a408768b216be7f759b4a190809f851a914d5 /include/asm-i386/ptrace.h | |
parent | bbab4f3bb7f528d2b8ccb5de9ae5f6ff3fb29684 (diff) | |
download | linux-7b3552024380f306a6c50d5105d18d9d4258fa4e.tar.xz |
[PATCH] i386: Profile pc badness
Profile_pc was broken when using paravirtualization because the
assumption the kernel was running at CPL 0 was violated, causing
bad logic to read a random value off the stack.
The only way to be in kernel lock functions is to be in kernel
code, so validate that assumption explicitly by checking the CS
value. We don't want to be fooled by BIOS / APM segments and
try to read those stacks, so only match KERNEL_CS.
I moved some stuff in segment.h to make it prettier.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'include/asm-i386/ptrace.h')
-rw-r--r-- | include/asm-i386/ptrace.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 1646996..6002597 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h @@ -49,6 +49,10 @@ static inline int user_mode_vm(struct pt_regs *regs) { return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; } +static inline int v8086_mode(struct pt_regs *regs) +{ + return (regs->eflags & VM_MASK); +} #define instruction_pointer(regs) ((regs)->eip) #define regs_return_value(regs) ((regs)->eax) |