]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390: Sort mcount locations at build time
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 13 Feb 2025 12:57:33 +0000 (13:57 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 18 Feb 2025 17:53:48 +0000 (18:53 +0100)
For s390 the mcount_loc section of the kernel image contains the addresses
of the mcount locations. All addresses will be adjusted with the same
offset by the decompressor before the kernel is started.

Therefore select HAVE_BUILDTIME_MCOUNT_SORT so that the entries of this
section are sorted at build time. Given that the same offset is applied to
all entries the section will be sorted in any case.

Note that this was not possible before commit 778666df60f0 ("s390: compile
relocatable kernel without -fPIE"). Since this commit all R_390_64 absolute
relocations are handled in a special way: only the address of the to be
changed location is put into a special section. For all those locations the
same offset is applied as described above.

Without that change it would have been necessary to also adjust the addend
of all relocations which correspond to the mcount_loc section, when sorting
the mcount_loc section.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Closes: https://lore.kernel.org/r/20250210142647.083ff456@gandalf.local.home/
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/Kconfig
arch/s390/configs/debug_defconfig

index 9c9ec08d78c71b4d227beeafab1b82d6434cb5c7..acaa1d1c12b2f02414abcbea006aa9c6be1419e9 100644 (file)
@@ -185,6 +185,7 @@ config S390
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_VMAP_STACK
        select HAVE_ASM_MODVERSIONS
+       select HAVE_BUILDTIME_MCOUNT_SORT
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
        select HAVE_DEBUG_KMEMLEAK
index d6beec5292a00ab3ec295a874bc15b0c43eff1fb..a2b0444b7d6b8791db28191fc2d9c9674208e768 100644 (file)
@@ -887,6 +887,7 @@ CONFIG_USER_EVENTS=y
 CONFIG_HIST_TRIGGERS=y
 CONFIG_FTRACE_STARTUP_TEST=y
 # CONFIG_EVENT_TRACE_STARTUP_TEST is not set
+CONFIG_FTRACE_SORT_STARTUP_TEST=y
 CONFIG_SAMPLES=y
 CONFIG_SAMPLE_TRACE_PRINTK=m
 CONFIG_SAMPLE_FTRACE_DIRECT=m