You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kallsyms: new /proc/kallmodsyms with builtin modules and symbol sizes
/proc/kallsyms is very useful for tracers and other tools that need to
map kernel symbols to addresses.
It would be useful if:
- there were a mapping between kernel symbol and module name
that only changed when the kernel source code is changed.
This mapping should not change simply because a module
becomes built into the kernel.
- there were symbol size information to determine whether an
address is within a symbol or outside it, especially given
that there could be huge gaps between symbols.
Therefore:
- Introduce a new config parameter CONFIG_KALLMODSYMS.
- Generate a file "modules_thick.builtin" that maps from
the thin archives that make up built-in modules to their
constituent object files.
- Generate a linker map ".tmp_vmlinux.map", converting it
into ".tmp_vmlinux.ranges", mapping address ranges to
object files.
- Change scripts/kallsyms.c stdin from "nm" to "nm -S" so that
symbol sizes are available. Have sort_symbols() incorporate
size info. Emit size info in the *.s output file. Skip the
.init.scratch section.
- If CONFIG_KALLMODSYMS, have scripts/kallsyms also read
"modules_thick.builtin" and ".tmp_vmlinux.ranges" to map
symbol addresses to built-in-module names and then write
those module names and per-symbol module information to
the *.s output file.
- Change module_get_kallsym() to return symbol size as well.
- In kernel/kallsyms:
- Use new, accurate symbol size information in get_symbol_pos(),
both to identify the correct symbol and to return correct size
information.
- Introduce a field builtin_module to say if the symbol is in a
built-in module.
- If CONFIG_KALLMODSYMS, produce a new /proc/kallmodsyms file,
akin to /proc/kallsyms but with built-in-module names and symbol
sizes.
The resulting /proc/kallmodsyms file looks like this:
ffffffff8b013d20 409 t pt_buffer_setup_aux
ffffffff8b014130 11f T intel_pt_interrupt
ffffffff8b014250 2d T cpu_emergency_stop_pt
ffffffff8b014280 13a t rapl_pmu_event_init [intel_rapl_perf]
ffffffff8b0143c0 bb t rapl_event_update [intel_rapl_perf]
ffffffff8b014480 10 t rapl_pmu_event_read [intel_rapl_perf]
ffffffff8b014490 a3 t rapl_cpu_offline [intel_rapl_perf]
ffffffff8b014540 24 t __rapl_event_show [intel_rapl_perf]
ffffffff8b014570 f2 t rapl_pmu_event_stop [intel_rapl_perf]
This is emitted even if intel_rapl_perf is built into the kernel.
As with /proc/kallsyms, non-root usage produces addresses that are
all zero; symbol sizes are treated similarly.
Programs that consume /proc/kallmodsyms should note that unlike
/proc/kallsyms, kernel symbols for built-in modules may appear
interspersed with other symbols that are part of different modules or
of the kernel.
Orabug: 30544408
Signed-off-by: Kris Van Hees <[email protected]>
Signed-off-by: Nick Alcock <[email protected]>
Signed-off-by: Eugene Loh <[email protected]>
Reviewed-by: Nick Alcock <[email protected]>
Reviewed-by: Kris Van Hees <[email protected]>
0 commit comments