]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
alloc_tag: remove empty module tag section
authorCasey Chen <cachen@purestorage.com>
Tue, 10 Jun 2025 16:22:58 +0000 (10:22 -0600)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:42:03 +0000 (22:42 -0700)
The empty MOD_CODETAG_SECTIONS() macro added an incomplete .data section
in module linker script, which caused symbol lookup tools like gdb to
misinterpret symbol addresses e.g., __ib_process_cq incorrectly mapping to
unrelated functions like below.

  (gdb) disas __ib_process_cq
  Dump of assembler code for function trace_event_fields_cq_schedule:

Removing the empty section restores proper symbol resolution and layout,
ensuring .data placement behaves as expected.

Link: https://lkml.kernel.org/r/20250610162258.324645-1-cachen@purestorage.com
Fixes: 0db6f8d7820a ("alloc_tag: load module tags into separate contiguous memory")
       22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
Signed-off-by: Casey Chen <cachen@purestorage.com>
Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Luis Chamberalin <mcgrof@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/asm-generic/codetag.lds.h
scripts/module.lds.S

index 372c320c5043781d8521948dbc316c4422b4c1d2..a45fe3d141a18bff224d2110a0f6dd6c7a86fa8d 100644 (file)
 #define CODETAG_SECTIONS()             \
        SECTION_WITH_BOUNDARIES(alloc_tags)
 
-/*
- * Module codetags which aren't used after module unload, therefore have the
- * same lifespan as the module and can be safely unloaded with the module.
- */
-#define MOD_CODETAG_SECTIONS()
-
 #define MOD_SEPARATE_CODETAG_SECTION(_name)    \
        .codetag.##_name : {                    \
                SECTION_WITH_BOUNDARIES(_name)  \
index 450f1088d5fd3643c9763abe4282bc62b45bd46b..ee79c41059f3d590961a9f94c8fd2bc4f2227057 100644 (file)
@@ -52,17 +52,12 @@ SECTIONS {
        .data : {
                *(.data .data.[0-9a-zA-Z_]*)
                *(.data..L*)
-               MOD_CODETAG_SECTIONS()
        }
 
        .rodata : {
                *(.rodata .rodata.[0-9a-zA-Z_]*)
                *(.rodata..L*)
        }
-#else
-       .data : {
-               MOD_CODETAG_SECTIONS()
-       }
 #endif
        MOD_SEPARATE_CODETAG_SECTIONS()
 }