public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Arun Sharma <asharma@fb.com>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 4/4] x86: Check user address explicitly in copy_from_user_nmi()
Date: Tue, 05 Jun 2012 18:55:42 +0200	[thread overview]
Message-ID: <1338915342.2749.11.camel@twins> (raw)
In-Reply-To: <1334961696-19580-5-git-send-email-asharma@fb.com>

On Fri, 2012-04-20 at 15:41 -0700, Arun Sharma wrote:
> Signed-off-by: Arun Sharma <asharma@fb.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: linux-kernel@vger.kernel.org
> ---
>  arch/x86/lib/usercopy.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
> index d6ae30b..2da7914 100644
> --- a/arch/x86/lib/usercopy.c
> +++ b/arch/x86/lib/usercopy.c
> @@ -21,6 +21,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
>  	void *map;
>  	int ret;
>  
> +	if (__range_not_ok(from, n, TASK_SIZE) == 0)
> +		return len;
> +
>  	do {
>  		ret = __get_user_pages_fast(addr, 1, 0, &page);
>  		if (!ret)

Needed the below to make it compile.. folded that.

---
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 
 #include <asm/word-at-a-time.h>
+#include <linux/sched.h>
 
 /*
  * best effort, GUP based copy_from_user() that is NMI-safe


  reply	other threads:[~2012-06-05 16:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 22:41 [PATCH 0/4] perf: Support multiple stacks (v3) Arun Sharma
2012-04-20 22:41 ` [PATCH 1/4] perf, x86: Allow multiple stacks Arun Sharma
2012-05-07 23:46   ` Arun Sharma
2012-06-06 16:02   ` [tip:perf/core] perf/x86: " tip-bot for Arun Sharma
2012-04-20 22:41 ` [PATCH 2/4] perf: Limit callchains to 127 Arun Sharma
2012-06-06 16:03   ` [tip:perf/core] " tip-bot for Arun Sharma
2012-04-20 22:41 ` [PATCH 3/4] perf, x86: Check if user fp is valid Arun Sharma
2012-06-06 16:03   ` [tip:perf/core] perf/x86: " tip-bot for Arun Sharma
2012-04-20 22:41 ` [PATCH 4/4] x86: Check user address explicitly in copy_from_user_nmi() Arun Sharma
2012-06-05 16:55   ` Peter Zijlstra [this message]
2012-06-06 16:04   ` [tip:perf/core] perf/x86: " tip-bot for Arun Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338915342.2749.11.camel@twins \
    --to=peterz@infradead.org \
    --cc=asharma@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox