[PATCH] ix86: really make user_mode() work correctly for VM86 mode

From: Jan Beulich
Date: Thu May 28 2015 - 04:16:57 EST


While commit efa7045103 ("x86/asm/entry: Make user_mode() work
correctly if regs came from VM86 mode") claims that "user_mode() is now
identical to user_mode_vm()", this wasn't actually the case - no prior
commit made it so.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andy Lutomirski <luto@xxxxxxxxxx>
---
arch/x86/include/asm/ptrace.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- 4.1-rc5/arch/x86/include/asm/ptrace.h
+++ 4.1-rc5-ix86-user_mode/arch/x86/include/asm/ptrace.h
@@ -107,7 +107,8 @@ static inline unsigned long regs_return_
static inline int user_mode(struct pt_regs *regs)
{
#ifdef CONFIG_X86_32
- return (regs->cs & SEGMENT_RPL_MASK) == USER_RPL;
+ return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK))
+ >= USER_RPL;
#else
return !!(regs->cs & 3);
#endif



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/