This is a note to let you know that I've just added the patch titled powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: powerpc-vmlinux.lds-define-runtime_discard_exit.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Thu Mar 2 03:05:39 2023 From: Tom Saeger <tom.saeger@xxxxxxxxxx> Date: Wed, 1 Mar 2023 19:04:53 -0700 Subject: powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx>, Tom Saeger <tom.saeger@xxxxxxxxxx>, stable@xxxxxxxxxxxxxxx, Michael Ellerman <mpe@xxxxxxxxxxxxxx> Message-ID: <20230210-tsaeger-upstream-linux-5-10-y-v3-2-f7f1b9e2196c@xxxxxxxxxx> From: Michael Ellerman <mpe@xxxxxxxxxxxxxx> commit 4b9880dbf3bdba3a7c56445137c3d0e30aaa0a40 upstream. The powerpc linker script explicitly includes .exit.text, because otherwise the link fails due to references from __bug_table and __ex_table. The code is freed (discarded) at runtime along with .init.text and data. That has worked in the past despite powerpc not defining RUNTIME_DISCARD_EXIT because DISCARDS appears late in the powerpc linker script (line 410), and the explicit inclusion of .exit.text earlier (line 280) supersedes the discard. However commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") introduced an earlier use of DISCARD as part of the RO_DATA macro (line 136). With binutils < 2.36 that causes the DISCARD directives later in the script to be applied earlier [1], causing .exit.text to actually be discarded at link time, leading to build errors: '.exit.text' referenced in section '__bug_table' of crypto/algboss.o: defined in discarded section '.exit.text' of crypto/algboss.o '.exit.text' referenced in section '__ex_table' of drivers/nvdimm/core.o: defined in discarded section '.exit.text' of drivers/nvdimm/core.o Fix it by defining RUNTIME_DISCARD_EXIT, which causes the generic DISCARDS macro to not include .exit.text at all. 1: https://lore.kernel.org/lkml/87fscp2v7k.fsf@xxxxxxxxx/ Fixes: 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230105132349.384666-1-mpe@xxxxxxxxxxxxxx Signed-off-by: Tom Saeger <tom.saeger@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/powerpc/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -8,6 +8,7 @@ #define BSS_FIRST_SECTIONS *(.bss.prominit) #define EMITS_PT_NOTE #define RO_EXCEPTION_TABLE_ALIGN 0 +#define RUNTIME_DISCARD_EXIT #include <asm/page.h> #include <asm-generic/vmlinux.lds.h> Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-5.10/sched-fair-detect-capacity-inversion.patch queue-5.10/powerpc-vmlinux.lds-don-t-discard-.rela-for-relocatable-builds.patch queue-5.10/sched-uclamp-make-cpu_overutilized-use-util_fits_cpu.patch queue-5.10/s390-define-runtime_discard_exit-to-fix-link-error-with-gnu-ld-2.36.patch queue-5.10/powerpc-vmlinux.lds-define-runtime_discard_exit.patch queue-5.10/sched-uclamp-make-select_idle_capacity-use-util_fits_cpu.patch queue-5.10/sched-uclamp-fix-fits_capacity-check-in-feec.patch queue-5.10/sched-fair-consider-capacity-inversion-in-util_fits_cpu.patch queue-5.10/sh-define-runtime_discard_exit.patch queue-5.10/sched-fair-fixes-for-capacity-inversion-detection.patch queue-5.10/sched-uclamp-make-asym_fits_capacity-use-util_fits_cpu.patch queue-5.10/sched-uclamp-fix-a-uninitialized-variable-warnings.patch queue-5.10/sched-uclamp-make-task_fits_capacity-use-util_fits_cpu.patch queue-5.10/arch-fix-broken-buildid-for-arm64-and-riscv.patch queue-5.10/sched-uclamp-cater-for-uclamp-in-find_energy_efficient_cpu-s-early-exit-condition.patch