This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: module function probe


Please see my comments. 

>-----Original Message-----
>From: systemtap-owner@sourceware.org 
>[mailto:systemtap-owner@sourceware.org] On Behalf Of Frank Ch. Eigler
>Sent: Friday, November 25, 2005 4:37 AM
>To: Mao, Bibo
>Cc: systemtap@sources.redhat.com
>Subject: Re: module function probe
>
>Hi -
>
>> 	I wrote one module named probed.ko after compiled, and the other
>> is kprobe module named probing.ko which is to probe some function
>> defined in probed.ko module. 
>> [...]
>> 		#insmod probed.ko
>> 		#insmod probing.ko
>> 		#rmmod probed.ko
>> 		#rmmod probing.ko
>> [...]
>
>To manage module reference counts in a way that prevents this problem,
>systemtap keeps a file descriptor open on some file under
>/sys/module/<PROBED>/.  By using plain insmod, you are giving up this
>protection.

I think we should implement this module reference count 
logic built in the kernel kprobes code.

Here is how it can be done.
register_kprobe(...)
{ 
.....
+	if ((mod = module_text_address((unsigned long) p->addr)))
+		if (unlikely(!try_module_get(mod))) return -EINVAL;

....
}

Unregister_kprobe(...)
{
....
+		module_put(module_text_address((unsigned long)p->addr));
...
}

Opened a bugzilla
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1954

Cheers,
Anil Keshavamurthy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]