<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="gmail_quote"><div>- 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:<br>



<br>int (*my_kallsyms_lookup_name)(const char *name) = (void *) KALLSYMS;<br><br>where KALLSYMS is address found above, or your loading script can feed this address. </div></div></blockquote><div> </div></div></div><div>


This is what i am currently doing but i need a cleaner way of doing this. <br></div></div></blockquote><div><br></div><div>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. </div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div>

<br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div>if your kernel is compiled with kprobe, you can use it to get address too.<br>




</div></div></blockquote></div><div><br>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.</div></div></blockquote><div><br></div><div>

I think following should work.</div><div><br></div><div>
struct kprobe kp;</div><div><br></div><div>memset(&amp;kp, 0, sizeof(kp));</div><div>kp.symbol_name = &quot;kallsyms_lookup_name&quot;;</div><div>if (!register_kprobe(&amp;kp))</div><div>   {</div><div>    my_kallsyms_lookup_name = (void *) kp.addr;</div>


<div>    unregister_kprobe(&amp;kp);</div><div>  } </div></div><br>