From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) by sourceware.org (Postfix) with ESMTPS id 0A6963894403 for ; Mon, 7 Jun 2021 17:45:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A6963894403 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 479BA160078; Mon, 7 Jun 2021 10:45:42 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 4e_aKsvKWYd9; Mon, 7 Jun 2021 10:45:41 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 98B861600C2; Mon, 7 Jun 2021 10:45:41 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bJczMbT3v31C; Mon, 7 Jun 2021 10:45:41 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 73D8C160078; Mon, 7 Jun 2021 10:45:41 -0700 (PDT) To: Noah Goldstein , Siddhesh Poyarekar Cc: GNU C Library References: <20210607083011.855616-1-goldstein.w.n@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [PATCH v1] x86: memcmp-avx2-movbe.S and memcmp-evex-movbe.S fix overflow bug. Message-ID: <8690911e-3cac-836b-2a8a-8b5b2ca74b02@cs.ucla.edu> Date: Mon, 7 Jun 2021 10:45:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Mon, 07 Jun 2021 17:45:44 -0000 On 6/7/21 10:28 AM, Noah Goldstein via Libc-alpha wrote: >=20 > Is it actually UB? The caller is not causing overflow. The implementati= on > method is. It is possible to implement without overflow. The C Standard says that unless otherwise specified, when you pass an=20 array (pointer + size) to a standard function, all the addresses in the=20 array must be valid. It's valid if (say) memcmp is multithreaded and=20 compares the first halves of the two arrays in parallel with comparing=20 the second halves. If I understand things correctly this patch isn't fixing a conformance=20 bug; it's merely a QoI issue, where by "quality" one means "I want this=20 particular undefined behavior to cause a core dump".