]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scripts: add verifier script for builtin module range data
authorKris Van Hees <kris.van.hees@oracle.com>
Fri, 6 Sep 2024 14:45:04 +0000 (10:45 -0400)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 20 Sep 2024 00:21:52 +0000 (09:21 +0900)
commitac7bd0945e3db5253bd03bfc40e71afafb08d225
treee8b20f51958ed9e45086e28a65e0c3959bdba8bd
parent5f5e7344322f0b0676579af054c787ed57d1c1df
scripts: add verifier script for builtin module range data

The modules.builtin.ranges offset range data for builtin modules is
generated at compile time based on the list of built-in modules and
the vmlinux.map and vmlinux.o.map linker maps.  This data can be used
to determine whether a symbol at a particular address belongs to
module code that was configured to be compiled into the kernel proper
as a built-in module (rather than as a standalone module).

This patch adds a script that uses the generated modules.builtin.ranges
data to annotate the symbols in the System.map with module names if
their address falls within a range that belongs to one or more built-in
modules.

It then processes the vmlinux.map (and if needed, vmlinux.o.map) to
verify the annotation:

  - For each top-level section:
     - For each object in the section:
        - Determine whether the object is part of a built-in module
          (using modules.builtin and the .*.cmd file used to compile
           the object as suggested in [0])
        - For each symbol in that object, verify that the built-in
          module association (or lack thereof) matches the annotation
          given to the symbol.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Tested-by: Sam James <sam@gentoo.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/verify_builtin_ranges.awk [new file with mode: 0755]