From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3A0C13846987 for ; Tue, 13 Dec 2022 23:29:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A0C13846987 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670974196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ygusNbVSM17kVY62HoRxp3otsUtp9IWMgg8dl3W7Cp8=; b=R+F6xuhFAwVu7gaVr+ZVF8ulvOcQT/p22sdKEeJzt7JsxNFnkqAnLMoEfflm5IECB4HhEA 0xrxu6FYjyMCnHYp8OQTJ26PZ7tDKEjGDfbLSxeCoAh95QPps3Msh5bp/cZqPlbr9eRcxw Ke+qEeKA4tSAKPDVuyjRHVcyR0mW5OI= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-312-PyPe94xANaGBNn2fzhyqSQ-1; Tue, 13 Dec 2022 18:29:55 -0500 X-MC-Unique: PyPe94xANaGBNn2fzhyqSQ-1 Received: by mail-il1-f198.google.com with SMTP id l13-20020a056e0212ed00b00304c6338d79so3443009iln.21 for ; Tue, 13 Dec 2022 15:29:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ygusNbVSM17kVY62HoRxp3otsUtp9IWMgg8dl3W7Cp8=; b=rH3OnYpLggyBkiB3qYGciX9IJw47w03H0wUMkbjItSL9v3RwDc6URZhUp918haPhY2 KpuHTbocezsd3I+H1w0DulcnPko0YW7KcPPWhywpws5JMs3tOvcABspdVR7MGGOUM4nD bLFOrXaggR5qpbsAJiHZsYXlZa38xLyJtuAaPG+qAdQ3bJGkt7Uksp+XWayL7Z1dgCzg gx8HtvMOuzOZmiBdBZg0RmUa3zJG3lhJHevuajgFAw+LR41L8yoeX8GeTeQbrSfOM5fe WqSvZPQKCMPuySeI9tUUT0ecYvP8IkZwvex83FafNy5APfYbyCCkLmInRg7BSzmWgvrr V9lA== X-Gm-Message-State: ANoB5pnjyc804GI7i/3z/gQEjF16LUp/2tKuzeUHBVt7fai68m6hboMm m+kDXiT9R64XUmtUx2KvAS8ZbnJz1ykZLW4p0tJIgHuT5NY8AE6qJej2RiMdYUcqZKAW337fiu0 7IKkom41wTSs8UB0TNspC X-Received: by 2002:a5d:8258:0:b0:6df:5a5d:5e8b with SMTP id n24-20020a5d8258000000b006df5a5d5e8bmr12654155ioo.9.1670974194679; Tue, 13 Dec 2022 15:29:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gcmGFQF875HC44CV+WJFnQKyw5y07LKM6s5pdwh6sJ8lU8RBtwc7f5svtNdtpUW+b84UaLA== X-Received: by 2002:a5d:8258:0:b0:6df:5a5d:5e8b with SMTP id n24-20020a5d8258000000b006df5a5d5e8bmr12654151ioo.9.1670974194404; Tue, 13 Dec 2022 15:29:54 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id x8-20020a0566380ca800b00389d6a02740sm1212669jad.157.2022.12.13.15.29.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 15:29:53 -0800 (PST) Message-ID: <736bb5b6-f9d5-b541-f983-1e5026aaacfa@redhat.com> Date: Tue, 13 Dec 2022 18:29:52 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: Bug 29863 - Segmentation fault in memcmp-sse2.S if memory contents can concurrently change To: Zack Weinberg , GNU libc development References: <0a1f01d90f1f$96c7ce60$c4576b20$@yottadb.com> <0b2901d90f26$f82b4720$e881d560$@yottadb.com> <38450ca5-599d-4e5d-b2db-be01856680cb@app.fastmail.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <38450ca5-599d-4e5d-b2db-be01856680cb@app.fastmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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 12/13/22 15:56, Zack Weinberg via Libc-alpha wrote: > On Tue, Dec 13, 2022, at 2:25 PM, Noah Goldstein via Libc-alpha wrote: >> On Tue, Dec 13, 2022 at 11:13 AM Narayanan Iyer wrote: >>> Thank you for acknowledging that it is a bug. >> I'm not sure this is a bug, I'm just saying to avoid this behavior you can >> make that change. >> >> I think we all agree supporting a correct non-atomic memcmp when the values >> in memory can change during execution is not reasonable. >> I think SIG11 is not a great outcome (of the many possible behaviors when its >> incorrect), but am not sure it's worth fixing. > > I think it would be reasonable for glibc to make the following weaker guarantee: > for any call `memcmp(a, b, n)`, if the data pointed to by `a` and/or `b` is being > concurrently modified, the return value is unspecified but *not* indeterminate. > Also, memcmp will never access memory outside the bounds [a, a+n) and [b, b+n), > no matter what. I disagree strongly. These are advanced lockless techniques. They should be hidden behind new APIs that provide the required guarantees. > This would, I believe, be sufficient to prevent a crash under the conditions > described by Narayanan Iyer. I would want to see compiler and langauge authors agree to such changes. -- Cheers, Carlos.