linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] x86, perf: Optimize stack walk user accesses
Date: Tue, 20 Oct 2015 13:03:32 +0200	[thread overview]
Message-ID: <20151020110332.GB17308@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1445295269-5672-2-git-send-email-andi@firstfloor.org>

On Mon, Oct 19, 2015 at 03:54:29PM -0700, Andi Kleen wrote:
> @@ -2307,7 +2312,13 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
>  		frame.next_frame	     = NULL;
>  		frame.return_address = 0;
>  
> -		bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
> +		if (!access_ok(VERIFY_READ, fp, 16))
> +			break;
> +
> +		bytes = __copy_from_user_nmi(&frame.next_frame, fp, 8);
> +		if (bytes != 0)
> +			break;
> +		bytes = __copy_from_user_nmi(&frame.return_address, fp+8, 8);
>  		if (bytes != 0)
>  			break;
>  

The previous patch that introduces this function states that any caller
must have pagefault_disable() or be from interrupt context.

Perf can call this function from !interrupt context (imagine a
tracepoint or other software event), should we therefore not add a
pagefault_disable()/enable() pair around the entire while() loop?

  reply	other threads:[~2015-10-20 11:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 22:54 [PATCH 1/2] x86: Add a __copy_from_user_nmi Andi Kleen
2015-10-19 22:54 ` [PATCH 2/2] x86, perf: Optimize stack walk user accesses Andi Kleen
2015-10-20 11:03   ` Peter Zijlstra [this message]
2015-10-20 17:32     ` Andi Kleen
2015-10-22 22:07 [PATCH 1/2] x86: Add a __copy_from_user_nmi Andi Kleen
2015-10-22 22:07 ` [PATCH 2/2] x86, perf: Optimize stack walk user accesses Andi Kleen
2015-11-16 23:23 [PATCH 1/2] x86: Add a __copy_from_user_nmi Andi Kleen
2015-11-16 23:23 ` [PATCH 2/2] x86, perf: Optimize stack walk user accesses Andi Kleen

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=20151020110332.GB17308@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).