resolving kernel addresses to symbol names via /proc/kallsyms

Milian Wolff
Tue Jan 31 13:39:00 GMT 2017

Hey all,

should I be able to resolve kernel addresses to symbol names with elfutils 
libdwfl? I did something like this:

    m_dwfl = dwfl_begin(m_callbacks);
    auto i_k = dwfl_linux_kernel_report_kernel(m_dwfl);
    auto i_m = dwfl_linux_kernel_report_modules(m_dwfl);

Both i_k and i_m returned 0. Then, I picked a random address from my /proc/
kallsyms, e.g.:

    ffffffff81001000 T hypercall_page

and try to find that symbol:

    auto module = dwfl_addrmodule(m_dwfl, 0xffffffff81001000ll);

The module is non-null and points me at this module (comparing to output I get 
from dwfl_getmodules):

    0x61400000fa40 kernel ffffffff81000000

But when I try to get a symbol, I get a nullptr:

    auto sym = dwfl_module_addrname(module, 0xffffffff81001000ll);

So, what am I missing?

Also, it doesn't seem to be possible to specify the path to the kallsyms file 
with the current dwfl_linux_kernel_report_kernel API - how is this intended to 
be handled? Should one instead use dwfl_linux_kernel_report_offline when one 
wants to support cross-machine analysis?

Milian Wolff

More information about the Elfutils-devel mailing list