lkml.org 
[lkml]   [2019]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 5/7] x86/mm, tracing: Fix CR2 corruption
On Sun, Jul 7, 2019 at 8:10 AM Andy Lutomirski <luto@kernel.org> wrote:
>
> On Thu, Jul 4, 2019 at 1:03 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > Despire the current efforts to read CR2 before tracing happens there
> > still exist a number of possible holes:
> >
> > idtentry page_fault do_page_fault has_error_code=1
> > call error_entry
> > TRACE_IRQS_OFF
> > call trace_hardirqs_off*
> > #PF // modifies CR2
> >
> > CALL_enter_from_user_mode
> > __context_tracking_exit()
> > trace_user_exit(0)
> > #PF // modifies CR2
> >
> > call do_page_fault
> > address = read_cr2(); /* whoopsie */
> >
> > And similar for i386.
> >
> > Fix it by pulling the CR2 read into the entry code, before any of that
> > stuff gets a chance to run and ruin things.
>
> Reviewed-by: Andy Lutomirski <luto@kernel.org>
>
> Subject to the discussion as to whether this is the right approach at all.

FWIW, I'm leaning toward suggesting that we apply the trivial tracing
fix and backport *that*. Then, in -tip, we could revert it and apply
this patch instead.

\
 
 \ /
  Last update: 2019-07-07 17:12    [W:1.096 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site