From: Sasha Levin Date: Wed, 11 Dec 2024 18:37:03 +0000 (-0500) Subject: Fixes for 5.15 X-Git-Tag: v5.4.287~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=986671b68ce3b524a1eb5f51f03bcc4a6d5697b1;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/modpost-add-.irqentry.text-to-other_sections.patch b/queue-5.15/modpost-add-.irqentry.text-to-other_sections.patch new file mode 100644 index 00000000000..213c81017ba --- /dev/null +++ b/queue-5.15/modpost-add-.irqentry.text-to-other_sections.patch @@ -0,0 +1,47 @@ +From fdd3192eaeaf79459d9db94dbfe2376fd600ca1d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 1 Dec 2024 12:17:30 +0100 +Subject: modpost: Add .irqentry.text to OTHER_SECTIONS + +From: Thomas Gleixner + +[ Upstream commit 7912405643a14b527cd4a4f33c1d4392da900888 ] + +The compiler can fully inline the actual handler function of an interrupt +entry into the .irqentry.text entry point. If such a function contains an +access which has an exception table entry, modpost complains about a +section mismatch: + + WARNING: vmlinux.o(__ex_table+0x447c): Section mismatch in reference ... + + The relocation at __ex_table+0x447c references section ".irqentry.text" + which is not in the list of authorized sections. + +Add .irqentry.text to OTHER_SECTIONS to cure the issue. + +Reported-by: Sergey Senozhatsky +Signed-off-by: Thomas Gleixner +Cc: stable@vger.kernel.org # needed for linux-5.4-y +Link: https://lore.kernel.org/all/20241128111844.GE10431@google.com/ +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/mod/modpost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c +index 43bacdee5cc5d..a663a0ea4066b 100644 +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -940,7 +940,7 @@ static void check_section(const char *modname, struct elf_info *elf, + ".kprobes.text", ".cpuidle.text", ".noinstr.text" + #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ + ".fixup", ".entry.text", ".exception.text", \ +- ".coldtext", ".softirqentry.text" ++ ".coldtext", ".softirqentry.text", ".irqentry.text" + + #define INIT_SECTIONS ".init.*" + #define MEM_INIT_SECTIONS ".meminit.*" +-- +2.43.0 + diff --git a/queue-5.15/modpost-include-.text.-in-text_sections.patch b/queue-5.15/modpost-include-.text.-in-text_sections.patch new file mode 100644 index 00000000000..453ce6310ae --- /dev/null +++ b/queue-5.15/modpost-include-.text.-in-text_sections.patch @@ -0,0 +1,53 @@ +From 2368900c737ba924aaeb8c5e38352eab49350d05 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Dec 2022 11:35:29 -0700 +Subject: modpost: Include '.text.*' in TEXT_SECTIONS + +From: Nathan Chancellor + +[ Upstream commit 19331e84c3873256537d446afec1f6c507f8c4ef ] + +Commit 6c730bfc894f ("modpost: handle -ffunction-sections") added +".text.*" to the OTHER_TEXT_SECTIONS macro to fix certain section +mismatch warnings. Unfortunately, this makes it impossible for modpost +to warn about section mismatches with LTO, which implies +'-ffunction-sections', as all functions are put in their own +'.text.' sections, which may still reference functions in +sections they are not supposed to, such as __init. + +Fix this by moving ".text.*" into TEXT_SECTIONS, so that configurations +with '-ffunction-sections' will see warnings about mismatched sections. + +Link: https://lore.kernel.org/Y39kI3MOtVI5BAnV@google.com/ +Reported-by: Vincent Donnefort +Reviewed-and-tested-by: Alexander Lobakin +Reviewed-by: Sami Tolvanen +Tested-by: Vincent Donnefort +Signed-off-by: Nathan Chancellor +Signed-off-by: Masahiro Yamada +Stable-dep-of: 7912405643a1 ("modpost: Add .irqentry.text to OTHER_SECTIONS") +Signed-off-by: Sasha Levin +--- + scripts/mod/modpost.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c +index c6e655e0ed988..43bacdee5cc5d 100644 +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -936,10 +936,10 @@ static void check_section(const char *modname, struct elf_info *elf, + #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS + + #define DATA_SECTIONS ".data", ".data.rel" +-#define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ ++#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \ + ".kprobes.text", ".cpuidle.text", ".noinstr.text" + #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ +- ".fixup", ".entry.text", ".exception.text", ".text.*", \ ++ ".fixup", ".entry.text", ".exception.text", \ + ".coldtext", ".softirqentry.text" + + #define INIT_SECTIONS ".init.*" +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series index 3d11da4fcf8..996a05a08e2 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -529,3 +529,5 @@ usb-chipidea-udc-handle-usb-error-interrupt-if-ioc-n.patch mips-loongson64-dts-really-fix-pcie-port-nodes-for-l.patch powerpc-prom_init-fixup-missing-powermac-size-cells.patch misc-eeprom-eeprom_93cx6-add-quirk-for-extra-read-cl.patch +modpost-include-.text.-in-text_sections.patch +modpost-add-.irqentry.text-to-other_sections.patch