All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ix86: really make user_mode() work correctly for VM86 mode
@ 2015-05-28  8:16 Jan Beulich
  2015-05-28 17:33 ` Andy Lutomirski
  2015-05-29  7:51 ` [tip:x86/urgent] x86/asm/entry/32: Really " tip-bot for Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2015-05-28  8:16 UTC (permalink / raw)
  To: mingo, tglx, hpa; +Cc: luto, linux-kernel

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@suse.com>
Cc: Andy Lutomirski <luto@kernel.org>
---
 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ix86: really make user_mode() work correctly for VM86 mode
  2015-05-28  8:16 [PATCH] ix86: really make user_mode() work correctly for VM86 mode Jan Beulich
@ 2015-05-28 17:33 ` Andy Lutomirski
  2015-05-29  7:49   ` Ingo Molnar
  2015-05-29  7:51 ` [tip:x86/urgent] x86/asm/entry/32: Really " tip-bot for Jan Beulich
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2015-05-28 17:33 UTC (permalink / raw)
  To: Jan Beulich
  Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

On May 28, 2015 1:16 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> 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.

That's embarrassing!  I'm not sure how I screwed that up.

Acked-by: Andy Lutomirski <luto@kernel.org>

This is needed for x86/urgent.  I'll see if I can write a simple test
case, too.  My old do_bounds test should be a good start.

--Andy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ix86: really make user_mode() work correctly for VM86 mode
  2015-05-28 17:33 ` Andy Lutomirski
@ 2015-05-29  7:49   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2015-05-29  7:49 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Jan Beulich, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org


* Andy Lutomirski <luto@amacapital.net> wrote:

> On May 28, 2015 1:16 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
> >
> > 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.
> 
> That's embarrassing!  I'm not sure how I screwed that up.

I should have noticed it too :-/

In fact I remember that I wanted to double check it all because the algorithmic 
complexity of the new test looked suspiciously too simple on the 32-bit side (we 
_did_ have a legitimate reason to keep the API split originally) - but forgot 
about it.

> Acked-by: Andy Lutomirski <luto@kernel.org>
> 
> This is needed for x86/urgent.

Yeah, queued it up.

> [...]  I'll see if I can write a simple test case, too.  My old do_bounds test 
> should be a good start.

That kind of test would be absolutely fantastic to have.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:x86/urgent] x86/asm/entry/32: Really make user_mode() work correctly for VM86 mode
  2015-05-28  8:16 [PATCH] ix86: really make user_mode() work correctly for VM86 mode Jan Beulich
  2015-05-28 17:33 ` Andy Lutomirski
@ 2015-05-29  7:51 ` tip-bot for Jan Beulich
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jan Beulich @ 2015-05-29  7:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: luto, dvlasenk, mingo, JBeulich, linux-kernel, tglx, peterz,
	torvalds, jbeulich, hpa, luto, brgerst, bp

Commit-ID:  7ba554b5ac69e5f3edac9ce3233beb5acd480878
Gitweb:     http://git.kernel.org/tip/7ba554b5ac69e5f3edac9ce3233beb5acd480878
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Thu, 28 May 2015 09:16:45 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 29 May 2015 09:46:40 +0200

x86/asm/entry/32: Really make user_mode() work correctly for VM86 mode

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@suse.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/5566EB0D020000780007E655@mail.emea.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/ptrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 19507ff..5fabf13 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -107,7 +107,7 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-29  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28  8:16 [PATCH] ix86: really make user_mode() work correctly for VM86 mode Jan Beulich
2015-05-28 17:33 ` Andy Lutomirski
2015-05-29  7:49   ` Ingo Molnar
2015-05-29  7:51 ` [tip:x86/urgent] x86/asm/entry/32: Really " tip-bot for Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.