From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by sourceware.org (Postfix) with ESMTPS id 43F0D385840C for ; Tue, 12 Mar 2024 19:04:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43F0D385840C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=canonical.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 43F0D385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.125.188.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710270256; cv=none; b=xguwGwFdeQ2D4/TXp8Z9MGtfgWjHAf32aVsBpXWpbrsuzuBf5krxyvL7G745J6hb591/DZaOOTBWgwP1m0IrFWY3NLtIrJkxlz+26vmjgWepOJivzoUFtfdYK8hPADwkj22SFcz3SOXA1iGWM0mrTKZTQIrRdtvoGe5geOroTzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710270256; c=relaxed/simple; bh=pDNFTWEQyphnnKBhiR0ROCHhLJO0lEe+J9Dm/TMGUjU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vfBSxLVgmdbFS2itnZdYc13IrMLOI4lIE4fWkMe7AyB8X45aOTUxgbXhv5J2zYWUUqz0TD6/2jHYSDaNWOBbb3IWfP/XXj3nIPYcIYhI4zQ7cTV9cfyxDv1OZgTegOvHZgo/jjV38p9d3kdnjTXMsavYQ5JWJakMNuWI8a3/0Aw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 7276B3F120 for ; Tue, 12 Mar 2024 19:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1710270252; bh=96X0SL1Hi1smXWRx/8JjkryH0VHqU2BVs8vtB6DO1hA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HdfVRhalySL/PFoyFp9auapbwROhYfSCAeKZFIIK1TY0huN7fQLETT3owEqYpDSii iMTnITcFMCcNVMXa9p97mFh7OXGVLADfQXXOBR/O6tlicTaIeXdwspXQ8RTJPFqyOA /PwwD6evHRfLwmEbm2i9QDeSHFiY9U72KDICimbfuLm4HgvqjD+tCkrBKKWBMH6caK sXKeIVD37P1T53DRfeFTBMznHRcmxc0Av063vofySe2QsALE+QXUT+vrrIQrlQl5D9 9lUAE1wRc0OoSW0KWCsFeslPpNJOk22Qilaj5BRFbOGnBlyoPfUIPdRvdZAa13DaIG CoZEv3Kt7Q0Sg== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-412db0e24aeso1348575e9.1 for ; Tue, 12 Mar 2024 12:04:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710270251; x=1710875051; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=96X0SL1Hi1smXWRx/8JjkryH0VHqU2BVs8vtB6DO1hA=; b=Uk9IAlweM7gbgLXtySnCc03RSquwdxU7tGGZyzFJKDAhIkiOXUdYQFZfracq6vA8qx OwrPUynN3/W+xTXMClx6cFIEW0aBXad3YcVffyxfCo61BPev0iS2+SYA15ulUFyZhCkZ x9K+skGyddDh7thRqGRt3mjX1TlmRAazq1j29yRI1ZbqQTJbuRHNNjWoiqgDiKo7d41x EdEc1XYP36vwtR00bZ3XCwopiG01lyhiKU64s8D4X21hXONWtNwogXg/I5gXa0k09wLo mmKMxg6VXpHuEmhG/8uY4nkBSqjVnPlclmWUUQG9HiyV8H9krOEkT7Y/P5L0B1Vle0j/ F6Bg== X-Gm-Message-State: AOJu0YxigHPEbX8z+C8hRwvPXv+quLw9oECGkQSJFBv5zgvho4Gh6k/e j3SJ1Z/vsHv5Bj2xCSAP3slt4j3RHwBIkMukAsc2nVuRoT7BP/fbPuruzYo32ZGegodTlJ1tC5c 57Se+X9ut1cFhRBj7U5hBdokCgn6l/ZXYuRmFxO409WdBHL9yjnsiwCNMZAdQc9oQo4H3QxzYxA 1ZHgc= X-Received: by 2002:a05:600c:4f54:b0:413:129d:66b6 with SMTP id m20-20020a05600c4f5400b00413129d66b6mr3793343wmq.15.1710270251142; Tue, 12 Mar 2024 12:04:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZPNdPrGhKJdZTdlHgOv40mb7sp8FNZzoBkKwYLB6EIJPOCNj7irDl5iVMxVUIKzZwrHA96A== X-Received: by 2002:a05:600c:4f54:b0:413:129d:66b6 with SMTP id m20-20020a05600c4f5400b00413129d66b6mr3793319wmq.15.1710270250537; Tue, 12 Mar 2024 12:04:10 -0700 (PDT) Received: from localhost ([2a01:e0a:169:7380:a72:aaba:1b89:ca9e]) by smtp.gmail.com with ESMTPSA id bh25-20020a05600c3d1900b004133365bbc6sm3188982wmb.19.2024.03.12.12.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 12:04:10 -0700 (PDT) From: Simon Chopin To: gcc-patches@gcc.gnu.org Cc: Simon Chopin Subject: [PATCH] libquadmath: printf: fix misaligned access on args Date: Tue, 12 Mar 2024 20:03:52 +0100 Message-ID: <20240312190352.3455451-1-simon.chopin@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On x86, this compiles into movdqa which segfaults on unaligned access. This kind of failure has been seen when running against glibc 2.39, which incidentally changed the printf implementation to move away from alloca() for this data to instead append it at the end of an existing "scratch buffer", with arbitrary alignement, whereas alloca() was probably more likely to be naturally aligned. Tested by adding the patch to the Ubuntu gcc-14 package in https://launchpad.net/~schopin/+archive/ubuntu/libquadmath Signed-off-by: Simon Chopin --- libquadmath/printf/printf_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libquadmath/printf/printf_fp.c b/libquadmath/printf/printf_fp.c index 8effcee88fa..d86aa650d38 100644 --- a/libquadmath/printf/printf_fp.c +++ b/libquadmath/printf/printf_fp.c @@ -363,7 +363,7 @@ __quadmath_printf_fp (struct __quadmath_printf_file *fp, /* Fetch the argument value. */ { - fpnum = **(const __float128 **) args[0]; + memcpy(&fpnum, *(void* const *) args[0], sizeof(fpnum)); /* Check for special values: not a number or infinity. */ if (isnanq (fpnum)) base-commit: 39737cdf002637c7a652e9c3e36f369cfce581e5 -- 2.43.0