From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from insect.birch.relay.mailchannels.net (insect.birch.relay.mailchannels.net [23.83.209.93]) by sourceware.org (Postfix) with ESMTPS id 0ABBE383575A for ; Thu, 23 Jun 2022 05:46:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0ABBE383575A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B1D191216A1; Thu, 23 Jun 2022 05:46:33 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2955F120FA5; Thu, 23 Jun 2022 05:46:33 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1655963193; a=rsa-sha256; cv=none; b=iKq/gbHS0KrykYKZM5zc4xPyw0jUDUdQt/k1caDsHRPVxchtD4yDkUEoghBZnGLhslKkw9 fGbZYgx4Kb33yMcVkWRDtQe4rmSnaDqK8q+y6Xd2QIEhIYUNmoiLEIM+nMaj6TmcyGHmSJ X4XC9H0LGhjkUGF+5OTaS0pOrF3NTJUZoaZgXLYs51h9UzUEnhxjL6NBBfQTeF9/hNu7YX FTglIL4qPL/unLxP4sciIl8uBRcM03IttxCn07LtNvaek4NQfaHZFMBQr65rANWyZp4xcn wJ7y7qEkscvisNlv5RrsIjZd8EAnbhMrLUkRQ/8TXv5/i8hAnmFeXMC/bhqvYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1655963193; 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:dkim-signature; bh=wM/HNwlZZcQDWF422ghDd3YqlMGYsK4WwN5WxxmaJlE=; b=i+PaiCbeHipZCDfveZ/PK0C+j9RaJDRUlLY0UTj0yM+/casre5LdfV01+/2MLZuSd3AV85 k9GsyYajsZKJxLdykTncIwc1CkukJ/TkGNAxif1HLfiJZBNn3FoxXJCaprXdjdZFwhXaX0 R2gFZbquoBHxU9ZDugOU99hYgSyQodh9fX2+PD08AqD2iH8SbQJbnEgKqTrmsLmSNLunVv XCXSAnqB/0MV3z/rQHMFAnUQaA+ylF7nVZiEKr91rriV1i21rEB0a9hSP17xrxvPzr5MTL T4y9OfFg81XR8gVmVfQoWu5Q9lgd0lt/UgjWaMobv6VgL8RX3PVHwMhwoJFyIg== ARC-Authentication-Results: i=1; rspamd-786f5898df-fkjhl; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Continue-Name: 242306b46ce50ceb_1655963193542_2127530560 X-MC-Loop-Signature: 1655963193542:857720158 X-MC-Ingress-Time: 1655963193542 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.112.55.213 (trex/6.7.1); Thu, 23 Jun 2022 05:46:33 +0000 Received: from [192.168.86.152] (unknown [103.199.173.0]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4LT8Pz6CHsz2d; Wed, 22 Jun 2022 22:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1655963192; bh=wM/HNwlZZcQDWF422ghDd3YqlMGYsK4WwN5WxxmaJlE=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=a/8srqGscBns7gbSZ+iEsL2MOvqNgqrdt0RFxL0TL1k1Je0f6kUF9gpE5BKVXIQl+ y5K3hsqcQWXfhPLwglZIPKEiSi1ht2E4ncdNM03PKSUf9SZfd1QXov6wV85lOGukSt ipOWaC9LnfIRZeXUZK4RMDlL8llT5fPkGxx2Cn8hhtzVQ0Bxltedt/VdQiWg78yzLQ jPM2iGu5gl1bfCCdRlKcaIPMqkLHp6SP0tQvMN1lywEZ4Iq/szLCDfwXG7SH1CDr1N w0ZZP1H8oshofdEFal5QlY+fKPqdBwkt7hDM3pcMQP5Ca4M+coa4aN4pUJpAmIkX+z R0XhJ7rnsM6yQ== Message-ID: Date: Thu, 23 Jun 2022 11:16:15 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v1] stdlib: Fixup mbstowcs NULL __dst handling. Content-Language: en-US To: Noah Goldstein , libc-alpha@sourceware.org References: <20220622233442.2777550-1-goldstein.w.n@gmail.com> From: Siddhesh Poyarekar In-Reply-To: <20220622233442.2777550-1-goldstein.w.n@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3038.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Thu, 23 Jun 2022 05:46:37 -0000 On 23/06/2022 05:04, Noah Goldstein via Libc-alpha wrote: > commit 464d189b9622932a75302290625de84931656ec0 (origin/master, origin/HEAD) > Author: Noah Goldstein > Date: Wed Jun 22 08:24:21 2022 -0700 > > stdlib: Remove attr_write from mbstows if dst is NULL [BZ: 29265] > > Incorrectly called `__mbstowcs_chk` in the NULL __dst case which is > incorrect as in the NULL __dst case we are explicitly skipping > the objsize checks. > > As well, remove the `__always_inline` attribute which exists in > `__fortify_function`. > --- > stdlib/bits/stdlib.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) LGTM. Reviewed-by: Siddhesh Poyarekar > > diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h > index d9c2d822a5..de1c3b20f0 100644 > --- a/stdlib/bits/stdlib.h > +++ b/stdlib/bits/stdlib.h > @@ -96,10 +96,10 @@ extern size_t __mbstowcs_chk (wchar_t *__restrict __dst, > const char *__restrict __src, > size_t __len, size_t __dstlen) __THROW > __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2)); > -extern size_t __REDIRECT_NTH (__mbstowcs_chk_nulldst, > +extern size_t __REDIRECT_NTH (__mbstowcs_nulldst, > (wchar_t *__restrict __dst, > const char *__restrict __src, > - size_t __len), mbstowcs_chk) > + size_t __len), mbstowcs) > __attr_access ((__read_only__, 2)); > extern size_t __REDIRECT_NTH (__mbstowcs_alias, > (wchar_t *__restrict __dst, > @@ -113,12 +113,12 @@ extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn, > __warnattr ("mbstowcs called with dst buffer smaller than len " > "* sizeof (wchar_t)"); > > -__always_inline __fortify_function size_t > +__fortify_function size_t > __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, > size_t __len)) > { > if (__builtin_constant_p (__dst == NULL) && __dst == NULL) > - return __mbstowcs_chk_nulldst (__dst, __src, __len); > + return __mbstowcs_nulldst (__dst, __src, __len); > else > return __glibc_fortify_n (mbstowcs, __len, sizeof (wchar_t), > __glibc_objsize (__dst), __dst, __src, __len);