Re: [PATCH 2.6.12-rc1-mm3] [1/2] kprobes += function-return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hien,

This patch looks good to me, but I have some comments on this patch.

>This patch adds function-return probes (AKA exit probes) to kprobes. 
> When establishing a probepoint at the entry to a function, you can also 
>establish a handler to be run when the function returns.

>The subsequent post give example of how function-return probes can be used.

>Two new registration interfaces are added to kprobes:

>int register_kretprobe(struct kprobe *kp, struct rprobe *rp);
>Registers a probepoint at the entry to the function whose address is 
>kp->addr.  Each time that function returns, rp->handler will be run.

>int register_jretprobe(struct jprobe *jp, struct rprobe *rp);
>Like register_kretprobe, except a jprobe is established for the probed 
>function.

Why two interfaces for the same feature?
You can provide a simple interface like

register_exitprobe(struct rprobe *rp) {
	....................
}

or 
int register_returnprobe(struct rprobe *rp) {

	....................
}

whichever you feel is a good name. 


independent of kprobe and jprobe.
This routine should take care to register entry handler internally if not 
present. This routine can check if there are already entry point kprobe/jprobe
and use some flags internally to say if the entry jprobe/kprobe already exists.

>To unregister, you still use unregister_kprobe or unregister_jprobe. To 
>probe only a function's returns, call register_kretprobe() and specify 
>NULL handlers for the kprobe.

make unregister exitprobes independent of kprobe/jprobe.

To unregister provide this interface 

unregister_exitprobe(struct rpobe *rp) { 
	....................
}

This routine should check if entry point kprobe/jprobe belows to user/ 
registered by exit probe. Remove the entry probe if no user has registered 
entry point kprobe/jprobe. If user has already registered entry point probes,
just leave the entry point probes and remove only the exit point probes.

Please let me know if you need more information.

Thanks
Prasanna
- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux