lkml.org 
[lkml]   [2014]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86 trace: Fix page fault tracing bug
On Fri, Feb 28, 2014 at 04:33:40PM +0100, Jiri Olsa wrote:

While I like the idea of just pushing up the CR2 read; the below does
the read too late still, exception_enter() also has a tracepoint in.

> @@ -1267,9 +1269,18 @@ dotraplinkage void __kprobes
> trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
> {
> enum ctx_state prev_state;
> + unsigned long address;
>
> prev_state = exception_enter();
> +
> + /*
> + * The tracepoint processing could trigger another page
> + * fault (user space callchain reading) and destroy the
> + * original cr2 value, so read the faulting address now.
> + */
> + address = read_cr2();
> +
> trace_page_fault_entries(regs, error_code);
> - __do_page_fault(regs, error_code);
> + __do_page_fault(regs, error_code, address);
> exception_exit(prev_state);
> }
> --
> 1.7.11.7
>


\
 
 \ /
  Last update: 2014-02-28 17:21    [W:0.064 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site