From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3751 invoked from network); 17 Jul 2023 16:22:27 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 17 Jul 2023 16:22:27 -0000 Received: (qmail 22196 invoked by uid 550); 17 Jul 2023 16:22:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 22161 invoked from network); 17 Jul 2023 16:22:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689610930; x=1692202930; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=320yAKW3D16D72h6eDRA5qONhr3dtJjyBRWYY4cpN50=; b=hcD2mZvMec08ML+DD6CsXLOcwpVjbdKRrXePq60QJZtYAKMU3tOE20YPYLD/GZuNGe G47+v7Zd3Id3bJR+SV9LhDhEfQ25WXeg+0dI3wLFP+51861o2I+q74PUfqal1vVWp8jo WTlb7nvIlOUKlrh613PxVOwjMOOyovmBDpl384bSvBVYj4zE738ch8drKn8aVj34l9tO d9qhpozcg2+Gcv7AwNirmQqZpzfaamcJJN0pyLx8xm7snD5er4VQmDWiWXWnqS16grtX zQswbC42ST7nFP2rEYUwNb5SfLv5rgQZiiWjaYj4nK2A/Ux1TLMFzmIzLntQXaBF9WiP PC3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689610930; x=1692202930; 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=320yAKW3D16D72h6eDRA5qONhr3dtJjyBRWYY4cpN50=; b=MPS9TSR4Us2GifNRx+OtsxYvkHYr+GOOpy3IfRGQrGy2zwaMN4KvmFaEUHizQKJ4uO Q8ofDutBYlRkhiDOYcG+nS7tCPIpPif7z1an66woa/NVjd78F+lsGUNjS8/peZXPOxD6 OwFyYXM7NWGM/hJFO5UELuiJFfp3IbddUhYJ9IXA3yXr87DEn3pHGz9efxjSvs9q0zfx x9zRdVEdQRqnc41kp8owpvZwWkJ0qKjRBfFEtAUpmbpNxqHKso6OG/704GtoWXCazxtb Ib7/nQgxr4kbMkx8XW1QjUapOElcEygfU/e0KItYVDn6nFUnEGu393WVDz7Zg2Jpz8XE Twaw== X-Gm-Message-State: ABy/qLZWfv3CfxyyqyZlDE/hXLOYUUKAKDfCLMOOmZqDy10DP5ch+34I 4K7H+CFaQ/Pm3uSoKdqAqAyQ3og73RARecVjP9Qtww== X-Google-Smtp-Source: APBJJlFC3VnnojBG9EEUYsRw8Zbw2vrlnxih6Jc7foPUVDdoyTIf+7qtz0uInN144KMgtQXlXPtUMA== X-Received: by 2002:a05:6830:1bdc:b0:6b8:7d12:423d with SMTP id v28-20020a0568301bdc00b006b87d12423dmr9236283ota.18.1689610930182; Mon, 17 Jul 2023 09:22:10 -0700 (PDT) Message-ID: Date: Mon, 17 Jul 2023 13:22:05 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: musl@lists.openwall.com, Robert Clausecker References: <20230716174945.qc6234b654k5eebx@gen2.localdomain> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [musl] strcmp() guarantees and assumptions On 16/07/23 18:13, Robert Clausecker wrote: > Hi Markus, > >> Also, glibc already has an SSE strcmp implementation you may want to >> look at. > > I'm not going to look at glibc as it's LGPL licensed. I am aware of the > Intel implementation, but I don't like that it has to duplicate the code > 16 times for each possible misalignment pattern. Without having to > ensure that a cacheline of data is only touched once we confirm there > is no previous mismatch, it might be possible to write simpler code, but > I'm currently not entirely sure how. On glibc side we have discussed the requirement of null-terminated for string functions on some occasions [1][2][3] and we leaned toward allows non-null terminated buffers for strncmp (where implementations must stop are either first null or the at end of the buffer) and require null-terminated buffers for strcmp. [1] https://sourceware.org/pipermail/libc-alpha/2023-February/145840.html [2] https://sourceware.org/pipermail/libc-alpha/2023-February/145860.html [3] https://sourceware.org/pipermail/libc-alpha/2023-February/145907.html