lkml.org 
[lkml]   [2009]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] tracing/profile: Fix profile_disable vs module_unload
From
Date
On Wed, 2009-08-26 at 15:10 +0800, Li Zefan wrote:
> Peter Zijlstra wrote:
> > On Wed, 2009-08-26 at 08:46 +0200, Peter Zijlstra wrote:
> >
> >> Aahh, I see the bug, its only ftrace that knows about the module, not
> >> tracepoints themselves, _that_ needs fixing.
> >
> > You could possibly do something like:
> >
> > struct module *tp_mod = __module_address(&some_tp_symbol);
> > struct module *cb_mod = __module_text_address(func);
> >
> > if (tp_mod && tp_mod != cb_mod) {
> > ret = try_get_module(tp_mod);
> > if (ret)
> > goto fail;
> > }
> >
> > in register_trace_##name() or thereabout.
> >
>
> Actually I tried it, but it didn't work. As I said, You can't find
> any tp symbol when registering tp callback. The same example again:
>
> In module bar, we have register_trace_foo()
> In module foo, we have DEFINE_TRACE(foo) and trace_foo().
>
> bar doesn't know any symbol of foo, so it can't bump foo's refcnt,

Well, clearly it knows about register_trace_foo() which itself knows at
least one symbol that should be in module foo, right? How else could it
register a callback in that module (if it were loaded)?

It appears to use some intermediate code, in which case the intermediate
code knows about foo, which too solves our problem.

> *Note: you can load module bar without loading module foo*

In which case the tracepoint registration fails, right?


\
 
 \ /
  Last update: 2009-08-26 09:29    [W:0.118 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site