lkml.org 
[lkml]   [2012]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/5] ftrace: Synchronize variable setting with breakpoints
From
Date
On Wed, 2012-05-30 at 21:28 -0400, Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@redhat.com>
>
> When the function tracer starts modifying the code via breakpoints
> it sets a variable (modifying_ftrace_code) to inform the breakpoint
> handler to call the ftrace int3 code.
>
> But there's no synchronization between setting this code and the
> handler, thus it is possible for the handler to be called on another
> CPU before it sees the variable. This will cause a kernel crash as
> the int3 handler will not know what to do with it.
>
> I originally added smp_mb()'s to force the visibility of the variable
> but H. Peter Anvin suggested that I just make it atomic.

Uhm,. maybe. atomic_{inc,dec}() implies a full memory barrier on x86,
but atomic_read() never has the smp_rmb() required.

Now smp_rmb() is mostly a nop on x86, except for CONFIG_X86_PPRO_FENCE.

So this should mostly work, but yuck.


Also, why does this stuff live in ftrace? I always thought you were
going to replace text_poke() so everybody that uses cross-modifying code
could profit?




\
 
 \ /
  Last update: 2012-05-31 13:41    [W:0.362 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site