lkml.org 
[lkml]   [2014]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: perf_fuzzer compiled for x32 causes reboot
On Fri, 28 Feb 2014 10:20:00 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> Below is a patch that should fix this. Please remove all other patches
> and try this out.

Updated patch, as Peter Zijlstra on IRC asked me if the
exception_enter() can be traced. And looking at it, it sure can be.

-- Steve

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 6dea040..f606b67 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1271,9 +1271,15 @@ dotraplinkage void __kprobes
trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
enum ctx_state prev_state;
+ unsigned long cr2;

+ /* The trace might fault, save the cr2 register */
+ cr2 = read_cr2();
prev_state = exception_enter();
trace_page_fault_entries(regs, error_code);
+ /* Put back the original cr2 if needed */
+ if (cr2 != read_cr2())
+ write_cr2(cr2);
__do_page_fault(regs, error_code);
exception_exit(prev_state);
}

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