xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] x86/xen: Simplify set_aliased_prot
       [not found] <cover.1464129798.git.luto@kernel.org>
@ 2016-05-24 22:48 ` Andy Lutomirski
       [not found] ` <0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Lutomirski @ 2016-05-24 22:48 UTC (permalink / raw)
  To: x86
  Cc: Kees Cook, Brian Gerst, linux-kernel, xen-devel, David Vrabel,
	Jan Beulich, Borislav Petkov, Andy Lutomirski, Andrew Cooper,
	Boris Ostrovsky

In aa1acff356bb ("x86/xen: Probe target addresses in
set_aliased_prot() before the hypercall"), I added an explicit probe
to work around a hypercall issue.  The code can be simplified by
using probe_kernel_read.

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <dvrabel@cantab.net>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/xen/enlighten.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 6ab672233ac9..eed696c229ba 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -521,9 +521,7 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 
 	preempt_disable();
 
-	pagefault_disable();	/* Avoid warnings due to being atomic. */
-	__get_user(dummy, (unsigned char __user __force *)v);
-	pagefault_enable();
+	probe_kernel_read(&dummy, (unsigned char *)v, 1);
 
 	if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
 		BUG();
-- 
2.5.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH 1/7] x86/xen: Simplify set_aliased_prot
       [not found] ` <0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org>
@ 2016-05-25  9:38   ` Andrew Cooper
  2016-05-25  9:50   ` David Vrabel
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2016-05-25  9:38 UTC (permalink / raw)
  To: Andy Lutomirski, x86
  Cc: Kees Cook, Brian Gerst, linux-kernel, xen-devel, David Vrabel,
	Borislav Petkov, Jan Beulich, Boris Ostrovsky

On 24/05/16 23:48, Andy Lutomirski wrote:
> In aa1acff356bb ("x86/xen: Probe target addresses in
> set_aliased_prot() before the hypercall"), I added an explicit probe
> to work around a hypercall issue.  The code can be simplified by
> using probe_kernel_read.
>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <dvrabel@cantab.net>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: xen-devel <xen-devel@lists.xen.org>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH 1/7] x86/xen: Simplify set_aliased_prot
       [not found] ` <0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org>
  2016-05-25  9:38   ` Andrew Cooper
@ 2016-05-25  9:50   ` David Vrabel
       [not found]   ` <57457582.9070608@citrix.com>
  2016-06-11  9:34   ` [tip:x86/asm] x86/xen: Simplify set_aliased_prot() tip-bot for Andy Lutomirski
  3 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2016-05-25  9:50 UTC (permalink / raw)
  To: Andy Lutomirski, x86
  Cc: Kees Cook, Brian Gerst, linux-kernel, xen-devel, Borislav Petkov,
	Jan Beulich, Andrew Cooper, Boris Ostrovsky

On 24/05/16 23:48, Andy Lutomirski wrote:
> In aa1acff356bb ("x86/xen: Probe target addresses in
> set_aliased_prot() before the hypercall"), I added an explicit probe
> to work around a hypercall issue.  The code can be simplified by
> using probe_kernel_read.

Acked-by: David Vrabel <david.vrabel@citrix.com>

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH 1/7] x86/xen: Simplify set_aliased_prot
       [not found]   ` <57457582.9070608@citrix.com>
@ 2016-06-10 22:12     ` Andy Lutomirski
       [not found]     ` <CALCETrWpo+QmdQ2n-QMojb954-oGgfHP0FBVbn6n6iR-+y6cNQ@mail.gmail.com>
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Lutomirski @ 2016-06-10 22:12 UTC (permalink / raw)
  To: David Vrabel, Ingo Molnar
  Cc: Kees Cook, Brian Gerst, X86 ML, linux-kernel, xen-devel,
	Jan Beulich, Borislav Petkov, Andy Lutomirski, Andrew Cooper,
	Boris Ostrovsky

On Wed, May 25, 2016 at 2:50 AM, David Vrabel <david.vrabel@citrix.com> wrote:
> On 24/05/16 23:48, Andy Lutomirski wrote:
>> In aa1acff356bb ("x86/xen: Probe target addresses in
>> set_aliased_prot() before the hypercall"), I added an explicit probe
>> to work around a hypercall issue.  The code can be simplified by
>> using probe_kernel_read.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>

Ingo, can you apply this one patch directly to x86/asm?  The rest of
the series is stalled pending my fixing Borislav's review comments
and, more importantly, fixing the bugs that testing it has shaken
loose.  This patch is a nice cleanup all by itself, though.

--Andy

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH 1/7] x86/xen: Simplify set_aliased_prot
       [not found]     ` <CALCETrWpo+QmdQ2n-QMojb954-oGgfHP0FBVbn6n6iR-+y6cNQ@mail.gmail.com>
@ 2016-06-11  9:29       ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2016-06-11  9:29 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Kees Cook, Brian Gerst, X86 ML, linux-kernel, xen-devel,
	Jan Beulich, Borislav Petkov, David Vrabel, Andy Lutomirski,
	Andrew Cooper, Boris Ostrovsky


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

> On Wed, May 25, 2016 at 2:50 AM, David Vrabel <david.vrabel@citrix.com> wrote:
> > On 24/05/16 23:48, Andy Lutomirski wrote:
> >> In aa1acff356bb ("x86/xen: Probe target addresses in
> >> set_aliased_prot() before the hypercall"), I added an explicit probe
> >> to work around a hypercall issue.  The code can be simplified by
> >> using probe_kernel_read.
> >
> > Acked-by: David Vrabel <david.vrabel@citrix.com>
> 
> Ingo, can you apply this one patch directly to x86/asm?  The rest of
> the series is stalled pending my fixing Borislav's review comments
> and, more importantly, fixing the bugs that testing it has shaken
> loose.  This patch is a nice cleanup all by itself, though.

Ok, agreed, done.

Note that I simplified it some more:

-       probe_kernel_read(&dummy, (unsigned char *)v, 1);
+       probe_kernel_read(&dummy, v, 1);

... because 'v' already has a 'void *' natural type.

Thanks,

	Ingo

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* [tip:x86/asm] x86/xen: Simplify set_aliased_prot()
       [not found] ` <0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org>
                     ` (2 preceding siblings ...)
       [not found]   ` <57457582.9070608@citrix.com>
@ 2016-06-11  9:34   ` tip-bot for Andy Lutomirski
  3 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Andy Lutomirski @ 2016-06-11  9:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, keescook, peterz, brgerst, linux-kernel, xen-devel,
	dvrabel, jbeulich, andrew.cooper3, bp, david.vrabel, luto, hpa,
	dvlasenk, boris.ostrovsky, luto, torvalds, mingo

Commit-ID:  99158f10e91768d34c5004c40c42f802b719bcae
Gitweb:     http://git.kernel.org/tip/99158f10e91768d34c5004c40c42f802b719bcae
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Tue, 24 May 2016 15:48:38 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 11 Jun 2016 11:28:11 +0200

x86/xen: Simplify set_aliased_prot()

A year ago, via the following commit:

  aa1acff356bb ("x86/xen: Probe target addresses in set_aliased_prot() before the hypercall")

I added an explicit probe to work around a hypercall issue.  The code can
be simplified by using probe_kernel_read().

No change in functionality.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Vrabel <dvrabel@cantab.net>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: xen-devel <xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/xen/enlighten.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 760789a..0f87db2 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -521,9 +521,7 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 
 	preempt_disable();
 
-	pagefault_disable();	/* Avoid warnings due to being atomic. */
-	__get_user(dummy, (unsigned char __user __force *)v);
-	pagefault_enable();
+	probe_kernel_read(&dummy, v, 1);
 
 	if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
 		BUG();

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-06-11  9:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1464129798.git.luto@kernel.org>
2016-05-24 22:48 ` [PATCH 1/7] x86/xen: Simplify set_aliased_prot Andy Lutomirski
     [not found] ` <0706f1a2538e481194514197298cca6b5e3f2638.1464129798.git.luto@kernel.org>
2016-05-25  9:38   ` Andrew Cooper
2016-05-25  9:50   ` David Vrabel
     [not found]   ` <57457582.9070608@citrix.com>
2016-06-10 22:12     ` Andy Lutomirski
     [not found]     ` <CALCETrWpo+QmdQ2n-QMojb954-oGgfHP0FBVbn6n6iR-+y6cNQ@mail.gmail.com>
2016-06-11  9:29       ` Ingo Molnar
2016-06-11  9:34   ` [tip:x86/asm] x86/xen: Simplify set_aliased_prot() tip-bot for Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).