On Mon, Aug 8, 2011 at 11:21 AM, Abu Rasheda <rcpilot2010@xxxxxxxxx> wrote:
- grep kallsyms_lookup from /proc/kallsyms (it is there on SL 5.5 and SL 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.if your kernel is compiled with kprobe, you can use it to get address too.
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.!
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies