Skip to contentSkip to conversation

Getting address of a symbol from kernel's symbol table.

DISCUSSION arif 2 participants 4 messages Dec 2, 2012 – Dec 3, 2012

lore
Share & tools
lore

arif

author
#0 lore raw

arif at khost:~/src/linux$ global -x ip_rcv_finish
ip_rcv_finish 319 net/ipv4/ip_input.c static int
ip_rcv_finish(struct sk_buff *skb)

Now if i want to use this function i need to initialize a pointer to this function.

To be able to do that i need the address of the function.

I've seen that from user space i can read /proc/kallsyms to get an address of a symbol. Is their any similar mechanism exist where i can read the symbol table to extract a symbol's address from kernel space?

#1 lore raw

Hi...

Quoted 5 lines · arif

To be able to do that i need the address of the function.

I've seen that from user space i can read /proc/kallsyms to get an address of a symbol. Is their any similar mechanism exist where i can read the symbol table to extract a symbol's address from kernel space?

check http://lxr.linux.no/#linux+v3.6.8/include/linux/kallsyms.h

I have a good guess, what you need is kallsyms_on_each_symbol()

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#2 lore raw
Quoted 5 lines · Mulyadi Santosa

Hi...

Quoted 2 lines · arif

To be able to do that i need the address of the function.

Quoted 8 lines
Quoted 3 lines

I've seen that from user space i can read /proc/kallsyms to get an address of a symbol. Is their any similar mechanism exist where i can read the symbol table to extract a symbol's address from kernel space?

check http://lxr.linux.no/#linux+v3.6.8/include/linux/kallsyms.h

I have a good guess, what you need is kallsyms_on_each_symbol()

Thanks for the pointer. I'm testing what can be done.

Signature · 2 lines
Cheers
arif
#3 lore raw
Quoted 1 line · Arif Hossain

Thanks for the pointer. I'm testing what can be done.

you welcome.... you can share back what you have found in the kernelnewbies :)

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com