From: Greg Kroah-Hartman Date: Sat, 25 Jul 2026 05:18:53 +0000 (+0200) Subject: 6.18-stable patches X-Git-Tag: v6.12.98~4 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ea91860a506ddf25cc674f881076403f21cfb554;p=thirdparty%2Fkernel%2Fstable-queue.git 6.18-stable patches added patches: seqlock-allow-kasan-to-fail-optimizing.patch seqlock-allow-ubsan_alignment-to-fail-optimizing.patch seqlock-cure-some-more-scoped_seqlock-optimization-fails.patch --- diff --git a/queue-6.18/seqlock-allow-kasan-to-fail-optimizing.patch b/queue-6.18/seqlock-allow-kasan-to-fail-optimizing.patch new file mode 100644 index 0000000000..55ed3f2a1d --- /dev/null +++ b/queue-6.18/seqlock-allow-kasan-to-fail-optimizing.patch @@ -0,0 +1,39 @@ +From b94d45b6bbb42571ec225d3be0e7457c8765a5b4 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 28 Oct 2025 09:56:38 +0100 +Subject: seqlock: Allow KASAN to fail optimizing + +From: Peter Zijlstra + +commit b94d45b6bbb42571ec225d3be0e7457c8765a5b4 upstream. + +Some KASAN builds are failing to properly optimize this code -- +luckily we don't care about core quality for KASAN builds, so just +exclude it. + +Reported-by: kernel test robot +Signed-off-by: Peter Zijlstra (Intel) +Closes: https://lore.kernel.org/oe-kbuild-all/202510251641.idrNXhv5-lkp@intel.com/ +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/seqlock.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/include/linux/seqlock.h ++++ b/include/linux/seqlock.h +@@ -1234,11 +1234,14 @@ static __always_inline void __scoped_seq + + extern void __scoped_seqlock_invalid_target(void); + +-#if defined(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 90000 ++#if (defined(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 90000) || defined(CONFIG_KASAN) + /* + * For some reason some GCC-8 architectures (nios2, alpha) have trouble + * determining that the ss_done state is impossible in __scoped_seqlock_next() + * below. ++ * ++ * Similarly KASAN is known to confuse compilers enough to break this. But we ++ * don't care about code quality for KASAN builds anyway. + */ + static inline void __scoped_seqlock_bug(void) { } + #else diff --git a/queue-6.18/seqlock-allow-ubsan_alignment-to-fail-optimizing.patch b/queue-6.18/seqlock-allow-ubsan_alignment-to-fail-optimizing.patch new file mode 100644 index 0000000000..26a189cf63 --- /dev/null +++ b/queue-6.18/seqlock-allow-ubsan_alignment-to-fail-optimizing.patch @@ -0,0 +1,49 @@ +From 88331c4ec23a28c1006ec532fa64763d4c695e90 Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Tue, 19 May 2026 13:03:15 +0200 +Subject: seqlock: Allow UBSAN_ALIGNMENT to fail optimizing + +From: Heiko Carstens + +commit 88331c4ec23a28c1006ec532fa64763d4c695e90 upstream. + +With gcc-15 and gcc-16 with UBSAN_ALIGNMENT enabled the compiler fails to +inline and optimize __scoped_seqlock_bug() away on s390: + +s390x-16.1.0-ld: kernel/sched/build_policy.o: in function `__scoped_seqlock_next': +/.../seqlock.h:1286:(.text+0x22030): undefined reference to `__scoped_seqlock_bug' + +Fix this by adding UBSAN_ALIGNMENT to the list of config options where a +not inlined empty __scoped_seqlock_bug() is allowed. + +Closes: https://lore.kernel.org/r/20260515092057.810542-1-arnd@kernel.org/ +Reported-by: Arnd Bergmann +Signed-off-by: Heiko Carstens +Signed-off-by: Peter Zijlstra (Intel) +Link: https://patch.msgid.link/20260519110315.1385307-1-hca@linux.ibm.com +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/seqlock.h | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/include/linux/seqlock.h ++++ b/include/linux/seqlock.h +@@ -1234,14 +1234,15 @@ static __always_inline void __scoped_seq + + extern void __scoped_seqlock_invalid_target(void); + +-#if (defined(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 90000) || defined(CONFIG_KASAN) ++#if (defined(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 90000) || \ ++ defined(CONFIG_KASAN) || defined(CONFIG_UBSAN_ALIGNMENT) + /* + * For some reason some GCC-8 architectures (nios2, alpha) have trouble + * determining that the ss_done state is impossible in __scoped_seqlock_next() + * below. + * +- * Similarly KASAN is known to confuse compilers enough to break this. But we +- * don't care about code quality for KASAN builds anyway. ++ * Similarly KASAN and UBSAN_ALIGNMENT are known to confuse compilers enough ++ * to break this. But we don't care about code quality for such builds anyway. + */ + static inline void __scoped_seqlock_bug(void) { } + #else diff --git a/queue-6.18/seqlock-cure-some-more-scoped_seqlock-optimization-fails.patch b/queue-6.18/seqlock-cure-some-more-scoped_seqlock-optimization-fails.patch new file mode 100644 index 0000000000..27107f8be6 --- /dev/null +++ b/queue-6.18/seqlock-cure-some-more-scoped_seqlock-optimization-fails.patch @@ -0,0 +1,47 @@ +From 90dfeef1cd38dff19f8b3a752d13bfd79f0f7694 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Thu, 4 Dec 2025 11:43:32 +0100 +Subject: seqlock: Cure some more scoped_seqlock() optimization fails + +From: Peter Zijlstra + +commit 90dfeef1cd38dff19f8b3a752d13bfd79f0f7694 upstream. + +Arnd reported an x86 randconfig using gcc-15 tripped over +__scoped_seqlock_bug(). Turns out GCC chose not to inline the +scoped_seqlock helper functions and as such was not able to optimize +properly. + +[ mingo: Clang fails the build too in some circumstances. ] + +Reported-by: Arnd Bergmann +Tested-by: Arnd Bergmann +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Cc: Oleg Nesterov +Link: https://patch.msgid.link/20251204104332.GG2528459@noisy.programming.kicks-ass.net +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/seqlock.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/include/linux/seqlock.h ++++ b/include/linux/seqlock.h +@@ -1224,7 +1224,7 @@ struct ss_tmp { + spinlock_t *lock_irqsave; + }; + +-static inline void __scoped_seqlock_cleanup(struct ss_tmp *sst) ++static __always_inline void __scoped_seqlock_cleanup(struct ss_tmp *sst) + { + if (sst->lock) + spin_unlock(sst->lock); +@@ -1249,7 +1249,7 @@ static inline void __scoped_seqlock_bug( + extern void __scoped_seqlock_bug(void); + #endif + +-static inline void ++static __always_inline void + __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state target) + { + switch (sst->state) { diff --git a/queue-6.18/series b/queue-6.18/series index b0d818b02e..98540a38c9 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -8,3 +8,6 @@ netfilter-nft_quota-use-atomic64_xchg-for-reset.patch netfilter-nf_tables-revert-commit_mutex-usage-in-res.patch drm-virtio-fix-deadlock-in-display_info_cb-by-removi.patch fs-proc-task_mmu-fix-make_uffd_wp_huge_pte-prot-upda.patch +seqlock-cure-some-more-scoped_seqlock-optimization-fails.patch +seqlock-allow-kasan-to-fail-optimizing.patch +seqlock-allow-ubsan_alignment-to-fail-optimizing.patch