lkml.org 
[lkml]   [2011]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 0/4] tracing,x86_64 - function/graph trace without mcount/-pg/framepointer
From
Date
On Thu, 2011-02-03 at 18:35 +0100, Frederic Weisbecker wrote:

> > ftrace could do that now, but it would require a separate handler. I
> > would need to disable preemption before calling the module code function
> > handler.
>
> Kprobes takes care of handlers from modules already.
> I'm not sure we want that, it makes the tracing code more sensitive.

Masami,

I'm looking at the optimize code, particularly
kprobes_optinsn_template_holder(), which looks to be the template that
is called on optimized kprobes. I don't see where preemption or
interrupts are disabled when a probe is called.

If modules can register probes, and we can call it in any arbitrary
location of the kernel, then preemption must be disabled prior to
calling the module code. Otherwise you risk crashing the system on
module unload.


module:
-------
register_kprobe(probe);

Core:
-----
hit break point
call probe
module:
-------
in probe function
preempted
module:
-------
unregister_kprobe(probe);
stop_machine();
<module unloaded>
Core:
-----
module <zombie>:
----------------
gets CPU again
executes module code that's been freed
DEATH BY ZOMBIES
Maybe I missed something. But does the optimize kprobes disable
preemption or interrupts before calling the optimized probe?

-- Steve




\
 
 \ /
  Last update: 2011-02-03 20:03    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site