From patchwork Thu Mar 24 20:50:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1609234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=R4jNs59V; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KPcnc2jVBz9s5V for ; Fri, 25 Mar 2022 07:51:00 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E658E3858406 for ; Thu, 24 Mar 2022 20:50:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E658E3858406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648155056; bh=o0KQLxgY2ZKJbX61GwAIyfVvI8gDKiQXUP3mSFcBIXI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=R4jNs59VQfVBXKYYQxpNmabX8b3eTsmQLttmaovFUtz8pjoLG8sHAguHHIeeqQO8T yCrg3j0F7/yuw7HKx64NlkXW2e2TA9qPRJ5utvHesp+VqkDjDIZ+4KcFKQJv1n2GN/ thxFMm2SflhZALyTGxVM/uMbE5zmOyfv2uAuLjBc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 58D1B3858D3C for ; Thu, 24 Mar 2022 20:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58D1B3858D3C Received: by mail-il1-x129.google.com with SMTP id e9so3978452ilu.9 for ; Thu, 24 Mar 2022 13:50:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o0KQLxgY2ZKJbX61GwAIyfVvI8gDKiQXUP3mSFcBIXI=; b=pRQW/0dszkrydRlNKTyqIAoV/cvscbMCjKDarA1eaxHTxL/Mrwev/tDugA+M69uckt zuiCTWs5KyV55QPehw3Qr1mJ7zbnmPI1VC/VWQm9dr2oRknA30p4IiDzO90qNENM3RZH BE/qmYNBAzPmhh8fLBy/fevpIUG/TxUOCdhMZeUJmMhV1WX2wP1dt0Z0VMUIfvHLuiHa YEdAEAgYp0XCzCNfKEzouYRtBp7gjt2u4fnnOviuEtF2i7Hm+WFFEaz8WD08WTCZ0P4H 9vKxxUtuB67BGXUySYEur4Yo/PeIQjIWmYnDPd8aFZ/m4oDmZkzc3yAYKEieMSWroXIV pAdA== X-Gm-Message-State: AOAM5338fqc+bPxbPCf3rADQfBjorAVCTPcgCbtz6D0TKcsHAK9JDghs QFiOkBPI6aBFeEbJ+2tzS3LWMv9e8Hw= X-Google-Smtp-Source: ABdhPJzB5YBYefsH/2XEiDLL+QsSScQ1mYx+5axipUyqHo0ZgfKB+p+NKALgkAl1QKQztEVFBA47NA== X-Received: by 2002:a92:dd86:0:b0:2bc:805c:23c7 with SMTP id g6-20020a92dd86000000b002bc805c23c7mr3504453iln.279.1648155042484; Thu, 24 Mar 2022 13:50:42 -0700 (PDT) Received: from localhost.localdomain (node-17-161.flex.volo.net. [76.191.17.161]) by smtp.googlemail.com with ESMTPSA id s12-20020a92cbcc000000b002bd04428740sm1954237ilq.80.2022.03.24.13.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 13:50:42 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 12/31] x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896] Date: Thu, 24 Mar 2022 15:50:33 -0500 Message-Id: <20220324205033.3274646-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220323215734.3927131-12-goldstein.w.n@gmail.com> References: <20220323215734.3927131-12-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Overflow case for __wcsncmp_avx2_rtm should be __wcscmp_avx2_rtm not __wcscmp_avx2. commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87 Author: Noah Goldstein Date: Sun Jan 9 16:02:21 2022 -0600 x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755] Set the wrong fallback function for `__wcsncmp_avx2_rtm`. It was set to fallback on to `__wcscmp_avx2` instead of `__wcscmp_avx2_rtm` which can cause spurious aborts. This change will need to be backported. All string/memory tests pass. Reviewed-by: H.J. Lu --- sysdeps/x86/tst-strncmp-rtm.c | 15 +++++++++++++++ sysdeps/x86_64/multiarch/strcmp-avx2.S | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sysdeps/x86/tst-strncmp-rtm.c b/sysdeps/x86/tst-strncmp-rtm.c index 300bc8c281..a3b14e72ff 100644 --- a/sysdeps/x86/tst-strncmp-rtm.c +++ b/sysdeps/x86/tst-strncmp-rtm.c @@ -70,6 +70,16 @@ function_overflow (void) return 1; } +__attribute__ ((noinline, noclone)) +static int +function_overflow2 (void) +{ + if (STRNCMP (string1, string2, SIZE_MAX >> 4) == 0) + return 0; + else + return 1; +} + static int do_test (void) { @@ -77,5 +87,10 @@ do_test (void) if (status != EXIT_SUCCESS) return status; status = do_test_1 (TEST_NAME, LOOP, prepare, function_overflow); + if (status != EXIT_SUCCESS) + return status; + status = do_test_1 (TEST_NAME, LOOP, prepare, function_overflow2); + if (status != EXIT_SUCCESS) + return status; return status; } diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S index 52ff5ad724..86a86b68e3 100644 --- a/sysdeps/x86_64/multiarch/strcmp-avx2.S +++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S @@ -122,7 +122,7 @@ ENTRY(STRCMP) are cases where length is large enough that it can never be a bound on valid memory so just use wcscmp. */ shrq $56, %rcx - jnz __wcscmp_avx2 + jnz OVERFLOW_STRCMP leaq (, %rdx, 4), %rdx # endif