Thread (6 messages) 6 messages, 3 authors, 2011-08-09

kallsyms_lookup_name

From: Venkatram Tummala <hidden>
Date: 2011-08-09 00:09:23

On Mon, Aug 8, 2011 at 11:21 AM, Abu Rasheda [off-list ref] wrote:
 - grep kallsyms_lookup from /proc/kallsyms (it is there on SL 5.5 and SL
quoted
quoted
6.0. You can edit your program and assign something like:

int (*my_kallsyms_lookup_name)(const char *name) = (void *) KALLSYMS;

where KALLSYMS is address found above, or your loading script can feed
this address.
This is what i am currently doing but i need a cleaner way of doing this.
Sometime, this is only thing you have, and this is pretty clean. You can
write a script, which could pass module parameter for the address of the
function.

quoted
if your kernel is compiled with kprobe, you can use it to get address too.
quoted
How do i do it using kprobes? To register a kprobe, i need the address of
kallsyms_lookup_name which is what i want in the first place.
 I think following should work.

struct kprobe kp;

memset(&kp, 0, sizeof(kp));
kp.symbol_name = "kallsyms_lookup_name";
if (!register_kprobe(&kp))
   {
    my_kallsyms_lookup_name = (void *) kp.addr;
    unregister_kprobe(&kp);
  }
Thanks. This is what i needed. Worked like a charm.!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110808/e0ff0491/attachment.html 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help