7
votes

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.

2

2 Answers

9
votes

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
11
votes

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.