From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id 016C1385840D for ; Tue, 23 Apr 2024 18:09:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 016C1385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 016C1385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713895793; cv=none; b=kOLBiTeifoRxjQCzHOt/8hQShPeyAuK/Gyv53AJvKC3KEraResJCipJP8rwytSt9P7kn9NrFONDPv9BKcPw3DW3d8JoMhlbbbf5ZWfpg2qv/ICuLvlxFvcsOingHatqusIzE4DdGrGbWD1zZaQUK+m5nagT96TxLOg26wCBkH7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713895793; c=relaxed/simple; bh=9bPcwi7XCLSIKQO/eUOVSZHagVNSylmUdDHhKz889J0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=JHl8m4wjQtobHl2t4KvwXxkX8sOYsduZbgk8Qigoh2DSgvnzo7z7+8h8z20wwXEELsetc2aP9Hb6kbZrQpHQEwvLMvLpkYijckaM9iKIGUVCnRQ3FB800bvH+IrzwcrJTsINqS4Hd/lcQzfZnSv8jzwClpE93FEQpnUn/otjYGE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id EE7FF3C00E410; Tue, 23 Apr 2024 11:09:49 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id DZW8tdzcVGJS; Tue, 23 Apr 2024 11:09:49 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9723C3C00E411; Tue, 23 Apr 2024 11:09:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 9723C3C00E411 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1713895789; bh=/bBVQdfAKybr3QPyQWOTzXFkRCZyCxR6pKIu6vxT9uM=; h=Message-ID:Date:MIME-Version:To:From; b=HDFP9Du+f9NpZvV6vHwFPydv0xtuas8Mc3fF2HP5zL7jfzqQAf09Udn3/4hugoG7d twUWAoKx175nEGjYQ/F4r1CwNypm8aOS+jIYnKnAEXc4Qw0H8/MHOZnIpX0Lw2F2Rm p3a7BUdWkYGNq/ooYHHPJrIvWPOtexq7MKtjr8uZK3Kxj+M0vUkiqrcp8tLSXuVtKk HmvV1T4iQfLcr3CGGyzYG8aXy6XpQHM878BzTlbkx7dtIw733ovzNti6g6Ttc4tT2P YBHxuyAu6UxG1pMv6a+AwWfwl80jRWSoHZTyfXUhKPpUhoZ6U8i14d+4ziCRQC+uOB 0cNOBEuHnVHww== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id SuK2YlcZy90P; Tue, 23 Apr 2024 11:09:49 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.154.17.165]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5D43F3C00E410; Tue, 23 Apr 2024 11:09:49 -0700 (PDT) Message-ID: <470fa772-d323-43b1-848f-038cc45992cb@cs.ucla.edu> Date: Tue, 23 Apr 2024 11:09:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: New GNU C Library (glibc) security flaw reported on 30 Jan 2024 To: Zack Weinberg , Florian Weimer Cc: Siddhesh Poyarekar , Vincent Lefevre , Xi Ruoyao , Adhemerval Zanella , Turritopsis Dohrnii Teo En Ming , GNU libc development , "ceo@teo-en-ming-corp.com" References: <20240131145555.GB2102@cventin.lip.ens-lyon.fr> <96521764f4636c9ea3f3089f369975c12fa8be77.camel@xry111.site> <20240201005155.GF3044@qaa.vinc17.org> <20240201090721.GH3044@qaa.vinc17.org> <5ea9eabb-f047-490f-abe9-43630d79c395@cs.ucla.edu> <7234533a-c8dd-4114-aa64-d4af3b138a3a@gotplt.org> <4d94a528-fe3f-413d-afa0-91a41f8371ff@app.fastmail.com> <1b2e16dd-4acf-45da-9285-7c6ce0e0fea6@cs.ucla.edu> <87bk6k1coe.fsf@oldenburg.str.redhat.com> <90ac2925-a833-4a2c-a7f7-9c28276b9222@app.fastmail.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <90ac2925-a833-4a2c-a7f7-9c28276b9222@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,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 2024-04-22 07:39, Zack Weinberg wrote: > On Mon, Apr 8, 2024, at 4:28 AM, Florian Weimer wrote: >> * Paul Eggert: >>> the same array element should always compare the same way with >>> the key. >> >> I don't think the requirement described in the last line actually >> exists. Some applications likely reuse the same key object to search >> for different values, and the requirement might prohibit that (but it >> is ambiguous). > > I believe what Paul was trying to express here is that *during a single > call to bsearch*, repeated calls to the comparison function with the > same (key, element) pair should return the same result. Yes. I was mimicking POSIX, which says: > When the same objects ... are passed more than once to the comparison function, the results shall be consistent with one another. That is, the same object shall always compare the same way with the key. Perhaps we should simply remove the word "always" from the glibc manual's phrasing? "Always" is not needed, and removing "always" should help avoid the unwanted implication that the requirement applies even to earlier or later bsearch invocations. By the way, this phrase is stating a POSIX requirement. glibc's implementation (like pretty much all other implementions) is more generous, and doesn't impose the requirement. I didn't bother stating this in the manual, as I didn't think it worth the trouble.