Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the kernel address of a loadable kernel module

I'm trying to find the kernel address space where my loadable kernel module is relocated by insmod.

I came to know that by using the -m, -O switches while insmod'ing the module, we can only see the symbol table and the executable's sections' addresses from the view-point of the module and not their relocated addresses, as that process of relocation is carried out when we do an insmod.

Can anyone tell how to find the relocated address of a module in the kernel-memory i.e the address bound within the kernel where a loaded module resides?

Thanks!

P.S Please note that I'm using a Redhat 2.4 Linux kernel in which the /proc/modules listing doesn't show the virtual addresses of the loaded modules.

like image 385
freax Avatar asked Mar 21 '13 02:03

freax


2 Answers

Go to directory /sys/module/<module-name>/sections/.text - will show where the code is loaded /sys/module/<module-name>/sections/.data will show the data section and .bss for the bss section of the module.

like image 52
Ulka Vaze Avatar answered Sep 19 '22 12:09

Ulka Vaze


You can get the core section pointer(virtual address, not physical memory address, but it can be converted to physical address) and the footprint size of the module from /proc/modules file.

Such as part of the file on my Linux box:

autofs4 29253 3 - Live 0xf9014000
hidp 23105 2 - Live 0xf900d000
rfcomm 42457 0 - Live 0xf8f84000
like image 23
tian_yufeng Avatar answered Sep 20 '22 12:09

tian_yufeng