This might be a bug in {k,}gdb. The .data section is honored correctly
by gdb, but the .text section isn't.

Guest:

> # cat /sys/module/dm_crypt/sections/{.text,.data}
> 0xffffffffa04a6000
> 0xffffffffa04ab000

GDB:

> (gdb) add-symbol-file drivers/md/dm-crypt.ko 0xffffffffa04a6000 -s .data 
> 0xffffffffa04ab000
> add symbol table from file "drivers/md/dm-crypt.ko" at
>         .text_addr = 0xffffffffa04a6000
>         .data_addr = 0xffffffffa04ab000
> (y or n) y
> Reading symbols from drivers/md/dm-crypt.ko...done.
> (gdb) info addr crypt_target
> Symbol "crypt_target" is static storage at address 0xffffffffa04ab020.
> (gdb) info addr dm_crypt_exit
> Symbol "dm_crypt_exit" is a function at address 0x4e.

Thanks,
Kamran.

On Sat, Jun 17, 2017 at 6:12 PM, Kamran Khan <krk...@inspirated.com> wrote:
> On the guest VM, I'm parsing kernel module's .text address with:
>
>> # cat /sys/module/dm_crypt/sections/{.text,.data}
>> 0xffffffffa04ee000
>> 0xffffffffa04f3000
>> root@ubuntu-zesty:~# cat /proc/kallsyms | grep dm_crypt_exit
>> ffffffffa04f14d2 t dm_crypt_exit [dm_crypt]
>
> When I load the module symbols at the .text address, it prompts me for
> the correct address:
>
>> (gdb) add-symbol-file drivers/md/dm-crypt.ko 0xffffffffa04ee000 -s .data 
>> 0xffffffffa04f3000
>> add symbol table from file "drivers/md/dm-crypt.ko" at
>> .text_addr = 0xffffffffa04ee000
>> .data_addr = 0xffffffffa04f3000
>> (y or n) y
>> Reading symbols from drivers/md/dm-crypt.ko...done.
>
> But when I query for the module's symbols, they're not loaded at the
> appropriate offset, making it impossible to set breakpoints.
>
>> (gdb) info address dm_crypt_exit
>> Symbol "dm_crypt_exit" is a function at address 0x4e.
>> (gdb) b dm_crypt_exit
>> Cannot access memory at address 0x4e
>
> Any ideas what's going wrong?
>
> Thanks,
> Kamran.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to