Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251589

Re: [PATCH 2/2] x86, perf: Optimize stack walk user accesses

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] x86, perf: Optimize stack walk user accesses
Date 2015-10-20 13:10 +0200
Message-ID <qlCXM-1Tf-5@gated-at.bofh.it> (permalink)
References <qlrzk-1Mv-23@gated-at.bofh.it> <qlrzk-1Mv-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] x86, perf: Optimize stack walk user accesses Andi Kleen <andi@firstfloor.org> - 2015-10-20 01:00 +0200
  Re: [PATCH 2/2] x86, perf: Optimize stack walk user accesses Peter Zijlstra <peterz@infradead.org> - 2015-10-20 13:10 +0200
    Re: [PATCH 2/2] x86, perf: Optimize stack walk user accesses Andi Kleen <andi@firstfloor.org> - 2015-10-20 19:40 +0200

csiph-web