Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: linux-hardening@vger.kernel.org, linux-s390@vger.kernel.org,
	Kees Cook <kees@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Marco Elver <elver@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	kasan-dev@googlegroups.com, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nick Terrell <terrelln@fb.com>, David Sterba <dsterba@suse.com>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] [RFC] ubsan: turn off UBSAN_ALIGNMENT on s390
Date: Fri, 15 May 2026 11:19:54 +0200	[thread overview]
Message-ID: <20260515092057.810542-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

Testing randconfig builds on s390 with gcc-15, I came across a number of
seemingly unrelated build failures that ended up all being caused
by the -fsanitize=alignment option:

s390-linux-ld: kernel/sched/build_policy.o: in function `thread_group_cputime':
include/linux/seqlock.h:1286:(.text+0x1f738): undefined reference to `__scoped_seqlock_bug'

lib/tests/overflow_kunit.c: In function 'same_type_test':
lib/tests/overflow_kunit.c:1008:13: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without

fs/fat/fat_test.c: In function 'fat_clus_to_blknr_test':
fs/fat/fat_test.c:33:1: error: the frame size of 4736 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
lib/crypto/chacha-block-generic.c: In function 'chacha_permute':
lib/crypto/chacha-block-generic.c:65:1: error: the frame size of 2000 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
lib/crypto/sha3.c: In function 'sha3_keccakf_generic':
lib/crypto/sha3.c:175:1: error: the frame size of 2248 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
lib/zstd/decompress/huf_decompress.c: In function 'HUF_decompress4X2_usingDTable_internal_default':
lib/zstd/decompress/huf_decompress.c:1512:1: error: the frame size of 1352 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]

What I observe here is a huge increase in generated calls to
__ubsan_handle_type_mismatch_v1() that ends up thowing off a number of
compiler optimizations that the kernel relies on.

I have not been able to figure out why this happens on s390 but not arm64,
arm or x86, if other toolchain versions are affected by the same thing,
and if this is a problem in gcc or in the kernel itself, e.g. some
variable being identified as unaligned when it should be aligned.

This clearly needs more investigation to figure out properly what is
going on, but turning it off is currently required for randconfig testing.

Cc: Kees Cook <kees@kernel.org>
Cc: Marco Elver <elver@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: kasan-dev@googlegroups.com
Cc: linux-hardening@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/Kconfig.ubsan | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index 1ecaae7064d2..3fc03a6b5af4 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -152,6 +152,7 @@ config UBSAN_ENUM
 
 config UBSAN_ALIGNMENT
 	bool "Perform checking for misaligned pointer usage"
+	depends on !S390 || BROKEN
 	default !HAVE_EFFICIENT_UNALIGNED_ACCESS
 	depends on !UBSAN_TRAP && !COMPILE_TEST
 	depends on $(cc-option,-fsanitize=alignment)
-- 
2.39.5


             reply	other threads:[~2026-05-15  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  9:19 Arnd Bergmann [this message]
2026-05-15 16:53 ` [PATCH] [RFC] ubsan: turn off UBSAN_ALIGNMENT on s390 Heiko Carstens
2026-05-15 20:51   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515092057.810542-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=dsterba@suse.com \
    --cc=elver@google.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=svens@linux.ibm.com \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox