Skip to content

Commit

Permalink
module: support kallsyms with modules.builtin.ranges
Browse files Browse the repository at this point in the history
Extend the support for different forms of symbol-to-address information
with nodule association.  We now support three different variaties:
 - kallmodsyms
 - kallsyms with modules.builtin.ranges
 - kallsyms w/o modules.builtin.ranges

The modules.builtin.ranges file contains data about address ranges that
contain symbols for one or more built-in modules.  Since the load
address of each kernel section is not known at kernel buildtime, this
file stores offset ranges relative to the load address of the section.

The file will look like this:

.text 00000000-00000000 = _text
.text 0000baf0-0000cb10 amd_uncore
.text 0009bd10-0009c8e0 iosf_mbi
...
.text 008e6660-008e9630 snd_soc_wcd_mbhc
.text 008e9630-008ea610 snd_soc_wcd9335 snd_soc_wcd934x snd_soc_wcd938x
.text 008ea610-008ea780 snd_soc_wcd9335
...
.data 00000000-00000000 = _sdata
.data 0000f020-0000f680 amd_uncore

For each ELF section, it lists the offset of the first symbol.  This can
be used to deteermine the base address of the section at runtime.

Next, it lists (in strict ascending order) offset ranges in that section
that cover the symbols of one or more builtin modules.  Multiple ranges
can apply to a single module, and ranges can be shared between modules.

When processing /proc/kallsyms with modules.builtin.ranges data, symbols
are annotated (as applicable) with a built-in module name.  If a symbol
belongs to multiple modules, multiple copies of the symbol will be added
with the same address but distinct module names.  This means that the
symbol will be found with modname`symname lookups, but reverse lookup on
the address will always give the first one found.  This is consistent
with existing behaviour in DTrace when two symbols refer to the same
address.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
  • Loading branch information
kvanhees committed Nov 8, 2023
1 parent 97b4e61 commit 6f52ca7
Showing 1 changed file with 293 additions and 139 deletions.

0 comments on commit 6f52ca7

Please sign in to comment.