From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from donkey.elm.relay.mailchannels.net (donkey.elm.relay.mailchannels.net [23.83.212.49]) by sourceware.org (Postfix) with ESMTPS id BACC63858C3A for ; Wed, 20 Oct 2021 03:16:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BACC63858C3A 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 34A99401935; Wed, 20 Oct 2021 03:16:34 +0000 (UTC) Received: from pdx1-sub0-mail-a48.g.dreamhost.com (100-96-11-21.trex.outbound.svc.cluster.local [100.96.11.21]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 57E73401944; Wed, 20 Oct 2021 03:16:33 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a48.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.11.21 (trex/6.4.3); Wed, 20 Oct 2021 03:16:33 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Coil-Obese: 657c8d0002431d45_1634699793603_4267108469 X-MC-Loop-Signature: 1634699793603:2613051675 X-MC-Ingress-Time: 1634699793603 Received: from pdx1-sub0-mail-a48.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a48.g.dreamhost.com (Postfix) with ESMTP id 183C87F01F; Tue, 19 Oct 2021 20:16:33 -0700 (PDT) Received: from [192.168.1.174] (unknown [1.186.123.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a48.g.dreamhost.com (Postfix) with ESMTPSA id C53937E3B4; Tue, 19 Oct 2021 20:16:30 -0700 (PDT) Message-ID: Date: Wed, 20 Oct 2021 08:46:24 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH 2/3] Make sure that the fortified function conditionals are constant Content-Language: en-US To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20211012161629.302696-1-siddhesh@sourceware.org> <20211012161629.302696-3-siddhesh@sourceware.org> X-DH-BACKEND: pdx1-sub0-mail-a48 From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3487.7 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SBL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 20 Oct 2021 03:16:37 -0000 On 10/20/21 01:04, Adhemerval Zanella via Libc-alpha wrote: > I am not sure if we still need to use reserved names (with double undescores) > on static inline functsion. The changes loos ok. User code defining "stream" to something weird? > Maybe to abstract the signed of the size within the macro itself: > > #define __glibc_type_signed(__t) (! ((__t) 0 < (__t) -1)) > > #define __glibc_safe_or_unknown_len_ex(__l, __s, __osz) \ > (__builtin_constant_p (__glibc_safe_len_cond (__l, __s, __osz)) \ > && __glibc_safe_len_cond (__l, __s, __osz)) > > #define __glibc_safe_or_unknown_len(__l, __s, __osz) \ > (__glibc_type_signed (__typeof__ (__s)) \ > ? __builtin_constant_p (__l) && (__l) > 0 \ > && __glibc_safe_or_unknown_len_ex ((__SIZE_TYPE__) (__l), (__s), (__osz))\ > : __glibc_safe_or_unknown_len_ex ((__l), (__s), (__osz))) > > And then remove __glibc_safe_or_unknown_len_signed and use > __glibc_safe_or_unknown_len instead? I think it slight less error prone so the > sign is checked automatically. I'll make this change, commit 1/3 and post a v2 patchset. Thanks, Siddhesh