]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jun 2025 14:12:24 +0000 (16:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jun 2025 14:12:24 +0000 (16:12 +0200)
added patches:
drm-amd-display-do-not-add-mhard-float-to-dml_ccflags-for-clang.patch
kbuild-add-clang_flags-to-as-instr.patch
kbuild-add-clang_flags-to-kbuild_cppflags.patch
kbuild-add-kbuild_cppflags-to-as-option-invocation.patch
mips-include-kbuild_cppflags-in-checkflags-invocation.patch
posix-cpu-timers-fix-race-between-handle_posix_cpu_timers-and-posix_cpu_timer_del.patch

queue-6.1/drm-amd-display-do-not-add-mhard-float-to-dml_ccflags-for-clang.patch [new file with mode: 0644]
queue-6.1/kbuild-add-clang_flags-to-as-instr.patch [new file with mode: 0644]
queue-6.1/kbuild-add-clang_flags-to-kbuild_cppflags.patch [new file with mode: 0644]
queue-6.1/kbuild-add-kbuild_cppflags-to-as-option-invocation.patch [new file with mode: 0644]
queue-6.1/mips-include-kbuild_cppflags-in-checkflags-invocation.patch [new file with mode: 0644]
queue-6.1/posix-cpu-timers-fix-race-between-handle_posix_cpu_timers-and-posix_cpu_timer_del.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/drm-amd-display-do-not-add-mhard-float-to-dml_ccflags-for-clang.patch b/queue-6.1/drm-amd-display-do-not-add-mhard-float-to-dml_ccflags-for-clang.patch
new file mode 100644 (file)
index 0000000..f0510a2
--- /dev/null
@@ -0,0 +1,43 @@
+From ede0c90fee40878969bd09b1eeeeec4c81fd3548 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Wed, 11 Jan 2023 20:05:09 -0700
+Subject: drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 7db038d9790eda558dd6c1dde4cdd58b64789c47 upstream.
+
+When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
+warns:
+
+  clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
+
+Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
+just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
+readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
+routines") added '-msse2' to prevent clang from emitting software
+floating point routines.
+
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
+Tested-by: Anders Roxell <anders.roxell@linaro.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>
+---
+ drivers/gpu/drm/amd/display/dc/dml/Makefile |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
++++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
+@@ -26,7 +26,8 @@
+ # subcomponents.
+ ifdef CONFIG_X86
+-dml_ccflags := -mhard-float -msse
++dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
++dml_ccflags := $(dml_ccflags-y) -msse
+ endif
+ ifdef CONFIG_PPC64
diff --git a/queue-6.1/kbuild-add-clang_flags-to-as-instr.patch b/queue-6.1/kbuild-add-clang_flags-to-as-instr.patch
new file mode 100644 (file)
index 0000000..508ad4c
--- /dev/null
@@ -0,0 +1,43 @@
+From e3843526e47cb379e5c8d2e8babf09ed52eb062b Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Thu, 1 Jun 2023 12:50:39 -0700
+Subject: kbuild: Add CLANG_FLAGS to as-instr
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit cff6e7f50bd315e5b39c4e46c704ac587ceb965f upstream.
+
+A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to
+KBUILD_CPPFLAGS so that '--target' is available while preprocessing.
+When that occurs, the following errors appear multiple times when
+building ARCH=powerpc powernv_defconfig:
+
+  ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12d4): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717520 is not in [-2147483648, 2147483647]; references '__start___soft_mask_table'
+  ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12e8): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717392 is not in [-2147483648, 2147483647]; references '__stop___soft_mask_table'
+
+Diffing the .o.cmd files reveals that -DHAVE_AS_ATHIGH=1 is not present
+anymore, because as-instr only uses KBUILD_AFLAGS, which will no longer
+contain '--target'.
+
+Mirror Kconfig's as-instr and add CLANG_FLAGS explicitly to the
+invocation to ensure the target information is always present.
+
+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/Makefile.compiler |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/Makefile.compiler
++++ b/scripts/Makefile.compiler
+@@ -38,7 +38,7 @@ as-option = $(call try-run,\
+ # Usage: aflags-y += $(call as-instr,instr,option1,option2)
+ as-instr = $(call try-run,\
+-      printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
++      printf "%b\n" "$(1)" | $(CC) -Werror $(CLANG_FLAGS) $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
+ # __cc-option
+ # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
diff --git a/queue-6.1/kbuild-add-clang_flags-to-kbuild_cppflags.patch b/queue-6.1/kbuild-add-clang_flags-to-kbuild_cppflags.patch
new file mode 100644 (file)
index 0000000..791c5d9
--- /dev/null
@@ -0,0 +1,51 @@
+From bd5c7eb183af3620b258db8b37b35fe5877069ae Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Sun, 9 Apr 2023 23:53:57 +0900
+Subject: kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit feb843a469fb0ab00d2d23cfb9bcc379791011bb upstream.
+
+When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is
+not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS.
+
+As a result, the linker script is preprocessed with predefined macros
+for the build host instead of the target.
+
+Assuming you use an x86 build machine, compare the following:
+
+ $ clang -dM -E -x c /dev/null
+ $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu
+
+There is no actual problem presumably because our linker scripts do not
+rely on such predefined macros, but it is better to define correct ones.
+
+Move $(CLANG_FLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S
+will be processed with the proper target triple.
+
+[Note]
+After the patch submission, we got an actual problem that needs this
+commit. (CBL issue 1859)
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/1859
+Reported-by: Tom Rini <trini@konsulko.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Tested-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/Makefile.clang |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/scripts/Makefile.clang
++++ b/scripts/Makefile.clang
+@@ -36,6 +36,5 @@ endif
+ # so they can be implemented or wrapped in cc-option.
+ CLANG_FLAGS   += -Werror=unknown-warning-option
+ CLANG_FLAGS   += -Werror=ignored-optimization-argument
+-KBUILD_CFLAGS += $(CLANG_FLAGS)
+-KBUILD_AFLAGS += $(CLANG_FLAGS)
++KBUILD_CPPFLAGS       += $(CLANG_FLAGS)
+ export CLANG_FLAGS
diff --git a/queue-6.1/kbuild-add-kbuild_cppflags-to-as-option-invocation.patch b/queue-6.1/kbuild-add-kbuild_cppflags-to-as-option-invocation.patch
new file mode 100644 (file)
index 0000000..3a1dcec
--- /dev/null
@@ -0,0 +1,58 @@
+From ecf28b98af1725b673156b702b4f731246b4fd0e Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Tue, 6 Jun 2023 15:40:35 -0700
+Subject: kbuild: Add KBUILD_CPPFLAGS to as-option invocation
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 43fc0a99906e04792786edf8534d8d58d1e9de0c upstream.
+
+After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to
+KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
+assembly files with clang:
+
+  arch/powerpc/lib/copypage_power7.S: Assembler messages:
+  arch/powerpc/lib/copypage_power7.S:34: Error: junk at end of line: `0b01000'
+  arch/powerpc/lib/copypage_power7.S:35: Error: junk at end of line: `0b01010'
+  arch/powerpc/lib/copypage_power7.S:37: Error: junk at end of line: `0b01000'
+  arch/powerpc/lib/copypage_power7.S:38: Error: junk at end of line: `0b01010'
+  arch/powerpc/lib/copypage_power7.S:40: Error: junk at end of line: `0b01010'
+  clang: error: assembler command failed with exit code 1 (use -v to see invocation)
+
+as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
+KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
+result of those missing flags, the host target
+will be tested during as-option calls and likely fail, meaning necessary
+flags may not get added when building assembly files, resulting in
+errors like seen above.
+
+Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
+This should have been done in commit d5c8d6e0fa61 ("kbuild: Update
+assembler calls to use proper flags and language target"), which
+switched from using the assembler target to the assembler-with-cpp
+target, so flags that affect preprocessing are passed along in all
+relevant tests. as-option now mirrors cc-option.
+
+Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
+Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
+Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Tested-by: Naresh Kamboju <naresh.kamboju@linaro.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/Makefile.compiler |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/Makefile.compiler
++++ b/scripts/Makefile.compiler
+@@ -32,7 +32,7 @@ try-run = $(shell set -e;            \
+ # Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
+ as-option = $(call try-run,\
+-      $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
++      $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
+ # as-instr
+ # Usage: aflags-y += $(call as-instr,instr,option1,option2)
diff --git a/queue-6.1/mips-include-kbuild_cppflags-in-checkflags-invocation.patch b/queue-6.1/mips-include-kbuild_cppflags-in-checkflags-invocation.patch
new file mode 100644 (file)
index 0000000..06ea136
--- /dev/null
@@ -0,0 +1,38 @@
+From 3bc7437c5a538d6173c863172c7222cc3b513088 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Thu, 1 Jun 2023 11:38:24 -0700
+Subject: mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 08f6554ff90ef189e6b8f0303e57005bddfdd6a7 upstream.
+
+A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to
+KBUILD_CPPFLAGS so that '--target' is available while preprocessing.
+When that occurs, the following error appears when building ARCH=mips
+with clang (tip of tree error shown):
+
+  clang: error: unsupported option '-mabi=' for target 'x86_64-pc-linux-gnu'
+
+Add KBUILD_CPPFLAGS in the CHECKFLAGS invocation to keep everything
+working after the move.
+
+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/mips/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/Makefile
++++ b/arch/mips/Makefile
+@@ -351,7 +351,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin
+ KBUILD_LDFLAGS                += -m $(ld-emul)
+ ifdef need-compiler
+-CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
++CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
+       grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
+       sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
+ endif
diff --git a/queue-6.1/posix-cpu-timers-fix-race-between-handle_posix_cpu_timers-and-posix_cpu_timer_del.patch b/queue-6.1/posix-cpu-timers-fix-race-between-handle_posix_cpu_timers-and-posix_cpu_timer_del.patch
new file mode 100644 (file)
index 0000000..78bef0c
--- /dev/null
@@ -0,0 +1,55 @@
+From f90fff1e152dedf52b932240ebbd670d83330eca Mon Sep 17 00:00:00 2001
+From: Oleg Nesterov <oleg@redhat.com>
+Date: Fri, 13 Jun 2025 19:26:50 +0200
+Subject: posix-cpu-timers: fix race between handle_posix_cpu_timers() and posix_cpu_timer_del()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Oleg Nesterov <oleg@redhat.com>
+
+commit f90fff1e152dedf52b932240ebbd670d83330eca upstream.
+
+If an exiting non-autoreaping task has already passed exit_notify() and
+calls handle_posix_cpu_timers() from IRQ, it can be reaped by its parent
+or debugger right after unlock_task_sighand().
+
+If a concurrent posix_cpu_timer_del() runs at that moment, it won't be
+able to detect timer->it.cpu.firing != 0: cpu_timer_task_rcu() and/or
+lock_task_sighand() will fail.
+
+Add the tsk->exit_state check into run_posix_cpu_timers() to fix this.
+
+This fix is not needed if CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y, because
+exit_task_work() is called before exit_notify(). But the check still
+makes sense, task_work_add(&tsk->posix_cputimers_work.work) will fail
+anyway in this case.
+
+Cc: stable@vger.kernel.org
+Reported-by: BenoĆ®t Sevens <bsevens@google.com>
+Fixes: 0bdd2ed4138e ("sched: run_posix_cpu_timers: Don't check ->exit_state, use lock_task_sighand()")
+Signed-off-by: Oleg Nesterov <oleg@redhat.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/time/posix-cpu-timers.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/kernel/time/posix-cpu-timers.c
++++ b/kernel/time/posix-cpu-timers.c
+@@ -1439,6 +1439,15 @@ void run_posix_cpu_timers(void)
+       lockdep_assert_irqs_disabled();
+       /*
++       * Ensure that release_task(tsk) can't happen while
++       * handle_posix_cpu_timers() is running. Otherwise, a concurrent
++       * posix_cpu_timer_del() may fail to lock_task_sighand(tsk) and
++       * miss timer->it.cpu.firing != 0.
++       */
++      if (tsk->exit_state)
++              return;
++
++      /*
+        * If the actual expiry is deferred to task work context and the
+        * work is already scheduled there is no point to do anything here.
+        */
index 35130b9e9d5c45c39f8861269bbab60a8adb4719..de2789f32e3c108b56f4cb51b8faf2b86f9fb856 100644 (file)
@@ -277,3 +277,9 @@ tools-resolve_btfids-fix-build-when-cross-compiling-kernel-with-clang.patch
 alsa-usb-audio-add-implicit-feedback-quirk-for-rode-ai-1.patch
 hid-usbhid-eliminate-recurrent-out-of-bounds-bug-in-usbhid_parse.patch
 revert-io_uring-ensure-deferred-completions-are-posted-for-multishot.patch
+posix-cpu-timers-fix-race-between-handle_posix_cpu_timers-and-posix_cpu_timer_del.patch
+drm-amd-display-do-not-add-mhard-float-to-dml_ccflags-for-clang.patch
+mips-include-kbuild_cppflags-in-checkflags-invocation.patch
+kbuild-add-clang_flags-to-as-instr.patch
+kbuild-add-clang_flags-to-kbuild_cppflags.patch
+kbuild-add-kbuild_cppflags-to-as-option-invocation.patch