| Message ID | 20261105001354.1471049-1-fuchsfl@gmail.com (mailing list archive) |
|---|---|
| State | Committed |
| Commit | ff45d05f8b0f3c8f576b2d3992263aad06488d40 |
| Headers |
Return-Path: <libc-alpha-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F064E4BA2E31 for <patchwork@sourceware.org>; Thu, 5 Nov 2026 00:15:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F064E4BA2E31 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=edOi6I/J X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id D581B4BA2E08 for <libc-alpha@sourceware.org>; Thu, 5 Nov 2026 00:14:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D581B4BA2E08 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D581B4BA2E08 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793837675; cv=none; b=Frvk+gLRsEAQ3Cr5rF+c485S2afHp6IlgGSHaolXMfaeQuCuChXVUt/+xco52rwjv8u9N8HScfINLSslxD/Uecq3aRt6caSxvDC1fMB33W887GNfw86a/+y/0qZU/JGTeQclIYC71u9QT3z1Usb1v6bkrAqtNz81sdbyvTHoZjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793837675; c=relaxed/simple; bh=XAJ/EnaJPzyOC+aORYrnt7UP7QvqVMMNygb4kOEMPOU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RCiYmdVtX/96C4BFY7kzf5sSyzjdOvr+rnBs4YB4uvgIKaiO6KuTw2IctRexwxhjLZ8kKpxDrjHwXKGh62QFzshQip95fn6NpKwKKhBuIBJSz7Ynb1mQ84ygZUUCgaHYWKaiZXCMt+XTLZ4zISQ6YqZn/NBi4oi/QTHO3C7UHrQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=edOi6I/J DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D581B4BA2E08 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-48e4831c028so1201495f8f.0 for <libc-alpha@sourceware.org>; Wed, 04 Nov 2026 16:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793837674; x=1794442474; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=bu3PomN8FoJeREl5TEATg0QiT4i3GcQK3KDHoRVc7jg=; b=edOi6I/JdrSRf4n8ptL/MtaV2hER3QrmN+Wm0tO4qYxf27SG1ghyRhCdaEnBgY9irb rDV3T1aUDmdYovUrUwrB0n5SOXU+wLlj5FzldMUSm9JTcASpIIuPPlxkjsFDw7qn939R wCw4/n3QeTWq5nbmLczSFPao1dnGKNmc4BjGQsSSuHZERsgedNta+3lCYpOWcd+XAaHG FmxrUAB2KeIIciMQ3uaOTs012Txnmnytyvf9ifOFCv80X1QOPjOVfESNSLrTa801Iywl WNjFWxEzTtrK+R7zfTQ/gVEEHmLnUY6fKMzeEWodZ9tilSRRnwjyovn/2lEvYaIsQMoP o8uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793837674; x=1794442474; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bu3PomN8FoJeREl5TEATg0QiT4i3GcQK3KDHoRVc7jg=; b=HnkF0Ahpg7n0rceBxPH5E0m+Hrqyv/rrDdg/Vt8fwdY8cHw+PEQSud+VYp4bHJh/qP eW+KRuuM+nWD4PL0B/tYM4ClkWFajvoIMH64yY0bt1rDEvMyBqeLjmMfuRnI+zqXSJzs Lw624hjaQB5+PAEMhAFQ7OTjPN6ihvOtsucseWBtP/wpVqgCEN+hHCNKaLTjLpLI8tpr 8OwymkN+0f3YQc8xONBtnA1P5FRjex/R8TES5WVIqFMXPQHTA+JJd27rg+UpwlzM0xIV OzHWibtU6bdR8D+jrSVT3vLjRcCXPVPSzI7dnHLzRJtO6zrWLDoisT6aNNsN0JBzGnpn pSoQ== X-Gm-Message-State: APuU4Z8ZPloHhzgAhln5pML4bp/m2sKK8hYXuzXQORG1WnOfNXMp9buO wbJtVN7c3C8JjQnVa5rqTAQ6X9tQh7UpMyZK2tTtMDdXl+Hb8UKOinqIzoRM178= X-Gm-Gg: AYBFou09ZogYiSkn9nOxfWspb3qtDsEETvl1Opw26ZPKvWl0ukMzKd04+wI/pq1adiz uNI4iVPfed7oknIsEyKq/C8i8wlVKdmxVJ0ZO4MbN6KUSOY6UrZtgt9NUEneTnoqWqp4Xd6SsX4 b+/GuSvqh03O2amqyeVN+BcIPZFYGxrbK9JM+XzEd9QWOjJWTC3nY2Wx1zUxRO+J9OzF/CdQHG5 g5bBQTzQA0NhgcHQ5Ytn+ZPIOoakDEhSv1Q6JUgzaCMFPJCJYMVa1pIjzpVY55msbyZHjPRj/Mi QRtxzAI9xvETIBUW1GxQiDE06sP6DqyXliX+s/Y/rkTQmwHpTW+r9FREtNU0RlRJICSBzjxxNni L9yokwTmeyvCiAjh/v55UONyDz0v2ne92yCFbFbj82OCQOOqn/ApJ+rnSQMDtCWR4udx939fnLu Y5psrckYzO+rHAGW7eVCActXawYMBwnjyv3vXv1fcSp00mDrSx/epbRo5hrGYV7W40eMm4AvBqh ygegFdKnSbENnxs6YvpXFVaQvv1ElJgCeMCUjlT1EYMai/3T7Bqb8JLUJ/vMLs9di3d1TD/oK+y jq9UymxejBzhAKbbRLu3o+ELY+bqJtfiQf+MpwpISXxU42QyfGaZeZ8j87aPBySH5DtKt3po9ne jogG9bJ0pFg== X-Received: by 2002:a05:6000:2911:b0:48d:f730:bda8 with SMTP id ffacd0b85a97d-48e6e50b1b8mr39204239f8f.50.1793837673483; Wed, 04 Nov 2026 16:14:33 -0800 (PST) Received: from localhost ([2a02:810d:4a94:b300:37c8:d893:8dc3:9d65]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-48fed552aaesm6863290f8f.40.2026.11.04.16.14.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2026 16:14:33 -0800 (PST) From: Florian Fuchs <fuchsfl@gmail.com> To: libc-alpha@sourceware.org, Stefan Liebler <stli@linux.ibm.com>, Andreas Krebbel <Andreas.Krebbel@de.ibm.com> Cc: Florian Fuchs <fuchsfl@gmail.com> Subject: [PATCH] s390: Fix missing early-clobber in __to_generic_vx [BZ #34952] Date: Thu, 5 Nov 2026 01:13:54 +0100 Message-ID: <20261105001354.1471049-1-fuchsfl@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
s390: Fix missing early-clobber in __to_generic_vx [BZ #34952]
|
|
Checks
| Context | Check | Description |
|---|---|---|
| redhat-pt-bot/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
| linaro-tcwg-bot/tcwg_glibc_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_glibc_check--master-arm | success | Test passed |
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 | fail | Patch failed to apply |
| redhat-pt-bot/TryBot-32bit | success | Build for i686 |
Commit Message
Florian Fuchs
Nov. 5, 2026, 12:13 a.m. UTC
R_TMP is declared as a plain output ("=d") without an early-clobber, so
the compiler may give it the same register as one of the inputs.
At -O1, GCC does so for R_BUF: the buffer address is zeroed and the
following "vst %v16,0(%[R_I],%[R_BUF])" stores to address 0. Any
conversion of 16 or more characters to IBM037, IBM1047 or a similar
8-bit charset then crashes. -O2 and -Os happen to allocate different
registers.
Mark R_TMP as early-clobber ("=&d"), like R_I in the same asm.
Reproducer, when glibc built with -O1:
head -c16 /dev/zero | tr '\0' A | iconv -f UTF-8 -t IBM1047
Tested on s390x with glibc built with -O1: the reproducer above
crashes without this change and works with it.
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
---
Issue was hit, while building s390-tools with an -O1 glibc: GCC with
-fexec-charset=IBM1047 crashed with an internal compiler error in
iconv. cmdline that reproduces the gcc ice:
echo 'const char *s = "Start subchannel failed";' | \
gcc -fexec-charset=IBM1047 -x c -c - -o /dev/null
sysdeps/s390/multiarch/8bit-generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/5/26 01:13, Florian Fuchs wrote: > R_TMP is declared as a plain output ("=d") without an early-clobber, so > the compiler may give it the same register as one of the inputs. > > At -O1, GCC does so for R_BUF: the buffer address is zeroed and the > following "vst %v16,0(%[R_I],%[R_BUF])" stores to address 0. Any > conversion of 16 or more characters to IBM037, IBM1047 or a similar > 8-bit charset then crashes. -O2 and -Os happen to allocate different > registers. > > Mark R_TMP as early-clobber ("=&d"), like R_I in the same asm. > > Reproducer, when glibc built with -O1: > > head -c16 /dev/zero | tr '\0' A | iconv -f UTF-8 -t IBM1047 > > Tested on s390x with glibc built with -O1: the reproducer above > crashes without this change and works with it. > > Signed-off-by: Florian Fuchs <fuchsfl@gmail.com> > --- > Issue was hit, while building s390-tools with an -O1 glibc: GCC with > -fexec-charset=IBM1047 crashed with an internal compiler error in > iconv. cmdline that reproduces the gcc ice: > > echo 'const char *s = "Start subchannel failed";' | \ > gcc -fexec-charset=IBM1047 -x c -c - -o /dev/null > > sysdeps/s390/multiarch/8bit-generic.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/s390/multiarch/8bit-generic.c b/sysdeps/s390/multiarch/8bit-generic.c > index 8224cec557..18671a8775 100644 > --- a/sysdeps/s390/multiarch/8bit-generic.c > +++ b/sysdeps/s390/multiarch/8bit-generic.c > @@ -266,7 +266,7 @@ > ".machine pop" \ > : /* outputs */ [R_IN] "+a" (inptr) \ > , [R_I] "=&a" (index) \ > - , [R_TMP] "=d" (tmp) \ > + , [R_TMP] "=&d" (tmp) \ > , [R_LI] "+d" (remaining_loop_count) \ > : /* inputs */ [R_BUF] "a" (buf) \ > , [R_MAX] "d" (max) \ Hi Florian, many thanks for the bug-report and the fix. You are absolute right, I also see the described register usages with -O1. With marking R_TMP as early clobber, different registers are used and the reproducer "head -c16 /dev/zero | tr '\0' A | iconv -f UTF-8 -t IBM1047" is fixed with an -O1 build. I've already double checked the remaining inline-assemblies in 8bit-generic.c for similar issues and will check the remaining s390x-inline-assemblies. Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
On 11/5/26 13:04, Stefan Liebler wrote: > On 11/5/26 01:13, Florian Fuchs wrote: >> R_TMP is declared as a plain output ("=d") without an early-clobber, so >> the compiler may give it the same register as one of the inputs. >> >> At -O1, GCC does so for R_BUF: the buffer address is zeroed and the >> following "vst %v16,0(%[R_I],%[R_BUF])" stores to address 0. Any >> conversion of 16 or more characters to IBM037, IBM1047 or a similar >> 8-bit charset then crashes. -O2 and -Os happen to allocate different >> registers. >> >> Mark R_TMP as early-clobber ("=&d"), like R_I in the same asm. >> >> Reproducer, when glibc built with -O1: >> >> head -c16 /dev/zero | tr '\0' A | iconv -f UTF-8 -t IBM1047 >> >> Tested on s390x with glibc built with -O1: the reproducer above >> crashes without this change and works with it. >> >> Signed-off-by: Florian Fuchs <fuchsfl@gmail.com> >> --- >> Issue was hit, while building s390-tools with an -O1 glibc: GCC with >> -fexec-charset=IBM1047 crashed with an internal compiler error in >> iconv. cmdline that reproduces the gcc ice: >> >> echo 'const char *s = "Start subchannel failed";' | \ >> gcc -fexec-charset=IBM1047 -x c -c - -o /dev/null >> >> sysdeps/s390/multiarch/8bit-generic.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sysdeps/s390/multiarch/8bit-generic.c b/sysdeps/s390/multiarch/8bit-generic.c >> index 8224cec557..18671a8775 100644 >> --- a/sysdeps/s390/multiarch/8bit-generic.c >> +++ b/sysdeps/s390/multiarch/8bit-generic.c >> @@ -266,7 +266,7 @@ >> ".machine pop" \ >> : /* outputs */ [R_IN] "+a" (inptr) \ >> , [R_I] "=&a" (index) \ >> - , [R_TMP] "=d" (tmp) \ >> + , [R_TMP] "=&d" (tmp) \ >> , [R_LI] "+d" (remaining_loop_count) \ >> : /* inputs */ [R_BUF] "a" (buf) \ >> , [R_MAX] "d" (max) \ > Hi Florian, > > many thanks for the bug-report and the fix. You are absolute right, I > also see the described register usages with -O1. With marking R_TMP as > early clobber, different registers are used and the reproducer "head > -c16 /dev/zero | tr '\0' A | iconv -f UTF-8 -t IBM1047" is fixed with an > -O1 build. > > I've already double checked the remaining inline-assemblies in > 8bit-generic.c for similar issues and will check the remaining > s390x-inline-assemblies. > > Reviewed-by: Stefan Liebler <stli@linux.ibm.com> Committed and also closed the bug (If there are still issues. Please reopen again). Thanks, Stefan
diff --git a/sysdeps/s390/multiarch/8bit-generic.c b/sysdeps/s390/multiarch/8bit-generic.c index 8224cec557..18671a8775 100644 --- a/sysdeps/s390/multiarch/8bit-generic.c +++ b/sysdeps/s390/multiarch/8bit-generic.c @@ -266,7 +266,7 @@ ".machine pop" \ : /* outputs */ [R_IN] "+a" (inptr) \ , [R_I] "=&a" (index) \ - , [R_TMP] "=d" (tmp) \ + , [R_TMP] "=&d" (tmp) \ , [R_LI] "+d" (remaining_loop_count) \ : /* inputs */ [R_BUF] "a" (buf) \ , [R_MAX] "d" (max) \