lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A94E7C7.70900@cn.fujitsu.com>
Date:	Wed, 26 Aug 2009 15:44:07 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Subject: Re: [PATCH] tracing/profile: Fix profile_disable vs module_unload

>>>>>> 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?
>>>
>> No, it won't fail. ;)
>>
>> Instead, when foo is loaded, tracepoint_update_probe_range() will be
>> called, and the probe registered in bar will be added to the tracepoint.
> 
> *blink*
> 
> so we'll succeed in registering a tracepoint we know isn't there?
> 

Yeah, try this:

# cd sample/tracepoints/
# insmod tracepoint-probe-sample.ko	<--- load trace probe firstly
# insmod tracepoint-sample.ko           <--- load tracepoint secondly
# cat /proc/tracepoint-sample
cat: /proc/tracepoint-sample: Operation not permitted	<-- pls ignore this
# dmesg							<-- see the output of probe
Event is encountered with filename tracepoint-sample
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
Event B is encountered
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ