]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Feb 2024 07:53:14 +0000 (08:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Feb 2024 07:53:14 +0000 (08:53 +0100)
added patches:
linux-init-remove-__memexit-annotations.patch
modpost-add-.ltext-and-.ltext.-to-text_sections.patch
modpost-don-t-let-driver-s-reference-.exit.patch
modpost-include-.text.-in-text_sections.patch
modpost-propagate-w-1-build-option-to-modpost.patch

queue-6.1/linux-init-remove-__memexit-annotations.patch [new file with mode: 0644]
queue-6.1/modpost-add-.ltext-and-.ltext.-to-text_sections.patch [new file with mode: 0644]
queue-6.1/modpost-don-t-let-driver-s-reference-.exit.patch [new file with mode: 0644]
queue-6.1/modpost-include-.text.-in-text_sections.patch [new file with mode: 0644]
queue-6.1/modpost-propagate-w-1-build-option-to-modpost.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/um-fix-adding-no-pie-for-clang.patch

diff --git a/queue-6.1/linux-init-remove-__memexit-annotations.patch b/queue-6.1/linux-init-remove-__memexit-annotations.patch
new file mode 100644 (file)
index 0000000..bee0e9a
--- /dev/null
@@ -0,0 +1,146 @@
+From a47c47ed8675735925e1c696128ccd3446dad187 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Mon, 23 Oct 2023 02:06:05 +0900
+Subject: linux/init: remove __memexit* annotations
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 6a4e59eeedc3018cb57722eecfcbb49431aeb05f upstream.
+
+We have never used __memexit, __memexitdata, or __memexitconst.
+
+These were unneeded.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+[nathan: Remove additional case of XXXEXIT_TO_SOME_EXIT due to lack of
+         78dac1a22944 in 6.1]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/asm-generic/vmlinux.lds.h |    6 ------
+ include/linux/init.h              |    3 ---
+ scripts/mod/modpost.c             |   16 +++-------------
+ 3 files changed, 3 insertions(+), 22 deletions(-)
+
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -351,7 +351,6 @@
+       *(.ref.data)                                                    \
+       *(.data..shared_aligned) /* percpu related */                   \
+       MEM_KEEP(init.data*)                                            \
+-      MEM_KEEP(exit.data*)                                            \
+       *(.data.unlikely)                                               \
+       __start_once = .;                                               \
+       *(.data.once)                                                   \
+@@ -546,7 +545,6 @@
+       __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {         \
+               *(.ref.rodata)                                          \
+               MEM_KEEP(init.rodata)                                   \
+-              MEM_KEEP(exit.rodata)                                   \
+       }                                                               \
+                                                                       \
+       /* Built-in module parameters. */                               \
+@@ -601,7 +599,6 @@
+               *(.ref.text)                                            \
+               *(.text.asan.* .text.tsan.*)                            \
+       MEM_KEEP(init.text*)                                            \
+-      MEM_KEEP(exit.text*)                                            \
+ /* sched.text is aling to function alignment to secure we have same
+@@ -751,13 +748,10 @@
+       *(.exit.data .exit.data.*)                                      \
+       *(.fini_array .fini_array.*)                                    \
+       *(.dtors .dtors.*)                                              \
+-      MEM_DISCARD(exit.data*)                                         \
+-      MEM_DISCARD(exit.rodata*)
+ #define EXIT_TEXT                                                     \
+       *(.exit.text)                                                   \
+       *(.text.exit)                                                   \
+-      MEM_DISCARD(exit.text)
+ #define EXIT_CALL                                                     \
+       *(.exitcall.exit)
+--- a/include/linux/init.h
++++ b/include/linux/init.h
+@@ -87,9 +87,6 @@
+                                                 __latent_entropy
+ #define __meminitdata    __section(".meminit.data")
+ #define __meminitconst   __section(".meminit.rodata")
+-#define __memexit        __section(".memexit.text") __exitused __cold notrace
+-#define __memexitdata    __section(".memexit.data")
+-#define __memexitconst   __section(".memexit.rodata")
+ /* For assembly routines */
+ #define __HEAD                .section        ".head.text","ax"
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -811,7 +811,7 @@ static void check_section(const char *mo
+ #define ALL_INIT_TEXT_SECTIONS \
+       ".init.text", ".meminit.text"
+ #define ALL_EXIT_TEXT_SECTIONS \
+-      ".exit.text", ".memexit.text"
++      ".exit.text"
+ #define ALL_PCI_INIT_SECTIONS \
+       ".pci_fixup_early", ".pci_fixup_header", ".pci_fixup_final", \
+@@ -819,10 +819,9 @@ static void check_section(const char *mo
+       ".pci_fixup_resume_early", ".pci_fixup_suspend"
+ #define ALL_XXXINIT_SECTIONS MEM_INIT_SECTIONS
+-#define ALL_XXXEXIT_SECTIONS MEM_EXIT_SECTIONS
+ #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS
+-#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS
++#define ALL_EXIT_SECTIONS EXIT_SECTIONS
+ #define DATA_SECTIONS ".data", ".data.rel"
+ #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \
+@@ -835,7 +834,6 @@ static void check_section(const char *mo
+ #define MEM_INIT_SECTIONS  ".meminit.*"
+ #define EXIT_SECTIONS      ".exit.*"
+-#define MEM_EXIT_SECTIONS  ".memexit.*"
+ #define ALL_TEXT_SECTIONS  ALL_INIT_TEXT_SECTIONS, ALL_EXIT_TEXT_SECTIONS, \
+               TEXT_SECTIONS, OTHER_TEXT_SECTIONS
+@@ -864,7 +862,6 @@ enum mismatch {
+       TEXT_TO_ANY_EXIT,
+       DATA_TO_ANY_EXIT,
+       XXXINIT_TO_SOME_INIT,
+-      XXXEXIT_TO_SOME_EXIT,
+       ANY_INIT_TO_ANY_EXIT,
+       ANY_EXIT_TO_ANY_INIT,
+       EXPORT_TO_INIT_EXIT,
+@@ -939,12 +936,6 @@ static const struct sectioncheck section
+       .bad_tosec = { INIT_SECTIONS, NULL },
+       .mismatch = XXXINIT_TO_SOME_INIT,
+ },
+-/* Do not reference exit code/data from memexit code/data */
+-{
+-      .fromsec = { ALL_XXXEXIT_SECTIONS, NULL },
+-      .bad_tosec = { EXIT_SECTIONS, NULL },
+-      .mismatch = XXXEXIT_TO_SOME_EXIT,
+-},
+ /* Do not use exit code/data from init code */
+ {
+       .fromsec = { ALL_INIT_SECTIONS, NULL },
+@@ -1089,7 +1080,7 @@ static int secref_whitelist(const struct
+       /* symbols in data sections that may refer to meminit sections */
+       if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
+-          match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
++          match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS)) &&
+           match(fromsym, PATTERNS("*driver")))
+               return 0;
+@@ -1267,7 +1258,6 @@ static void report_sec_mismatch(const ch
+       case TEXT_TO_ANY_EXIT:
+       case DATA_TO_ANY_EXIT:
+       case XXXINIT_TO_SOME_INIT:
+-      case XXXEXIT_TO_SOME_EXIT:
+       case ANY_INIT_TO_ANY_EXIT:
+       case ANY_EXIT_TO_ANY_INIT:
+               warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n",
diff --git a/queue-6.1/modpost-add-.ltext-and-.ltext.-to-text_sections.patch b/queue-6.1/modpost-add-.ltext-and-.ltext.-to-text_sections.patch
new file mode 100644 (file)
index 0000000..c86142f
--- /dev/null
@@ -0,0 +1,51 @@
+From 7e3d85ff880b1b5640c7f8a694615380ce09a8a3 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Tue, 23 Jan 2024 15:59:55 -0700
+Subject: modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 397586506c3da005b9333ce5947ad01e8018a3be upstream.
+
+After the linked LLVM change, building ARCH=um defconfig results in a
+segmentation fault in modpost. Prior to commit a23e7584ecf3 ("modpost:
+unify 'sym' and 'to' in default_mismatch_handler()"), there was a
+warning:
+
+  WARNING: modpost: vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown)
+  WARNING: modpost: The relocation at __ex_table+0x88 references
+  section ".ltext" which is not in the list of
+  authorized sections.  If you're adding a new section
+  and/or if this reference is valid, add ".ltext" to the
+  list of authorized sections to jump to on fault.
+  This can be achieved by adding ".ltext" to
+  OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.
+
+The linked LLVM change moves global objects to the '.ltext' (and
+'.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large',
+which ARCH=um uses. These sections should be handled just as '.text'
+and '.text.*' are, so add them to TEXT_SECTIONS.
+
+Cc: stable@vger.kernel.org
+Closes: https://github.com/ClangBuiltLinux/linux/issues/1981
+Link: https://github.com/llvm/llvm-project/commit/4bf8a688956a759b7b6b8d94f42d25c13c7af130
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/mod/modpost.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -825,7 +825,8 @@ static void check_section(const char *mo
+ #define DATA_SECTIONS ".data", ".data.rel"
+ #define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \
+-              ".kprobes.text", ".cpuidle.text", ".noinstr.text"
++              ".kprobes.text", ".cpuidle.text", ".noinstr.text", \
++              ".ltext", ".ltext.*"
+ #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
+               ".fixup", ".entry.text", ".exception.text", \
+               ".coldtext", ".softirqentry.text"
diff --git a/queue-6.1/modpost-don-t-let-driver-s-reference-.exit.patch b/queue-6.1/modpost-don-t-let-driver-s-reference-.exit.patch
new file mode 100644 (file)
index 0000000..856b35f
--- /dev/null
@@ -0,0 +1,57 @@
+From 036a47643b18d2b0754a86902c1e7e76173fbc3f Mon Sep 17 00:00:00 2001
+From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
+Date: Sat, 30 Sep 2023 18:52:04 +0200
+Subject: modpost: Don't let "driver"s reference .exit.*
+
+From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
+
+commit f177cd0c15fcc7bdbb68d8d1a3166dead95314c8 upstream.
+
+Drivers must not reference functions marked with __exit as these likely
+are not available when the code is built-in.
+
+There are few creative offenders uncovered for example in ARCH=amd64
+allmodconfig builds. So only trigger the section mismatch warning for
+W=1 builds.
+
+The dual rule that drivers must not reference .init.* is implemented
+since commit 0db252452378 ("modpost: don't allow *driver to reference
+.init.*") which however missed that .exit.* should be handled in the
+same way.
+
+Thanks to Masahiro Yamada and Arnd Bergmann who gave valuable hints to
+find this improvement.
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/mod/modpost.c |   15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -1087,9 +1087,20 @@ static int secref_whitelist(const struct
+                                   "*_console")))
+               return 0;
+-      /* symbols in data sections that may refer to meminit/exit sections */
++      /* symbols in data sections that may refer to meminit sections */
+       if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
+-          match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
++          match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
++          match(fromsym, PATTERNS("*driver")))
++              return 0;
++
++      /*
++       * symbols in data sections must not refer to .exit.*, but there are
++       * quite a few offenders, so hide these unless for W=1 builds until
++       * these are fixed.
++       */
++      if (!extra_warn &&
++          match(fromsec, PATTERNS(DATA_SECTIONS)) &&
++          match(tosec, PATTERNS(EXIT_SECTIONS)) &&
+           match(fromsym, PATTERNS("*driver")))
+               return 0;
diff --git a/queue-6.1/modpost-include-.text.-in-text_sections.patch b/queue-6.1/modpost-include-.text.-in-text_sections.patch
new file mode 100644 (file)
index 0000000..27c6e75
--- /dev/null
@@ -0,0 +1,48 @@
+From a2633f3fd62266b7b480e2247b48b2400b0b1fbe Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Tue, 13 Dec 2022 11:35:29 -0700
+Subject: modpost: Include '.text.*' in TEXT_SECTIONS
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 19331e84c3873256537d446afec1f6c507f8c4ef upstream.
+
+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.<func_name>' 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 <vdonnefort@google.com>
+Reviewed-and-tested-by: Alexander Lobakin <alexandr.lobakin@intel.com>
+Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
+Tested-by: Vincent Donnefort <vdonnefort@google.com>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/mod/modpost.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -824,10 +824,10 @@ static void check_section(const char *mo
+ #define ALL_EXIT_SECTIONS EXIT_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.*"
diff --git a/queue-6.1/modpost-propagate-w-1-build-option-to-modpost.patch b/queue-6.1/modpost-propagate-w-1-build-option-to-modpost.patch
new file mode 100644 (file)
index 0000000..0c1f166
--- /dev/null
@@ -0,0 +1,67 @@
+From 8a6779d66db859df16b8b948ba6e51f467a8c6f4 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Tue, 6 Jun 2023 18:41:59 +0900
+Subject: modpost: propagate W=1 build option to modpost
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 20ff36856fe00879f82de71fe6f1482ca1b72334 upstream.
+
+"No build warning" is a strong requirement these days, so you must fix
+all issues before enabling a new warning flag.
+
+We often add a new warning to W=1 first so that the kbuild test robot
+blocks new breakages.
+
+This commit allows modpost to show extra warnings only when W=1
+(or KBUILD_EXTRA_WARN=1) is given.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/Makefile.modpost |    1 +
+ scripts/mod/modpost.c    |    7 ++++++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/scripts/Makefile.modpost
++++ b/scripts/Makefile.modpost
+@@ -44,6 +44,7 @@ modpost-args =                                                                               \
+       $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E)                                  \
+       $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))                                     \
+       $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)       \
++      $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W)                                  \
+       -o $@
+ # 'make -i -k' ignores compile errors, and builds as many modules as possible.
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -41,6 +41,8 @@ static bool allow_missing_ns_imports;
+ static bool error_occurred;
++static bool extra_warn;
++
+ /*
+  * Cut off the warnings when there are too many. This typically occurs when
+  * vmlinux is missing. ('make modules' without building vmlinux.)
+@@ -2290,7 +2292,7 @@ int main(int argc, char **argv)
+       LIST_HEAD(dump_lists);
+       struct dump_list *dl, *dl2;
+-      while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
++      while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
+               switch (opt) {
+               case 'e':
+                       external_module = true;
+@@ -2315,6 +2317,9 @@ int main(int argc, char **argv)
+               case 'T':
+                       files_source = optarg;
+                       break;
++              case 'W':
++                      extra_warn = true;
++                      break;
+               case 'w':
+                       warn_unresolved = true;
+                       break;
index 2e615aed36853f6b910b0d319fc1827cae4b0150..1cc7ca76e3b3a623ff927bd1c12a0eebe3bca052 100644 (file)
@@ -83,7 +83,12 @@ nfc-nci-free-rx_data_reassembly-skb-on-nci-device-cleanup.patch
 net-hsr-remove-warn_once-in-send_hsr_supervision_frame.patch
 net-stmmac-do-not-clear-tbs-enable-bit-on-link-up-down.patch
 xen-netback-properly-sync-tx-responses.patch
+modpost-propagate-w-1-build-option-to-modpost.patch
+modpost-don-t-let-driver-s-reference-.exit.patch
+linux-init-remove-__memexit-annotations.patch
+modpost-include-.text.-in-text_sections.patch
 um-fix-adding-no-pie-for-clang.patch
+modpost-add-.ltext-and-.ltext.-to-text_sections.patch
 alsa-hda-realtek-enable-headset-mic-on-vaio-vjfe-adl.patch
 asoc-codecs-wcd938x-handle-deferred-probe.patch
 alsa-hda-cs8409-suppress-vmaster-control-for-dolphin-models.patch
index b8ca0fa2857e067c48b378caa418fe13e19decbf..8a2c708c74f5d241a32f338cd3c2ab8f8b5384a5 100644 (file)
@@ -1,4 +1,4 @@
-From 846cfbeed09b45d985079a9173cf390cc053715b Mon Sep 17 00:00:00 2001
+From e6c03b847dfa1346953fc9585e77edf1aa2561e0 Mon Sep 17 00:00:00 2001
 From: Nathan Chancellor <nathan@kernel.org>
 Date: Tue, 23 Jan 2024 15:59:54 -0700
 Subject: um: Fix adding '-no-pie' for clang
@@ -43,6 +43,7 @@ Cc: stable@vger.kernel.org
 Closes: https://github.com/ClangBuiltLinux/linux/issues/1982
 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
  arch/um/Makefile |    4 +++-