From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from butterfly.birch.relay.mailchannels.net (butterfly.birch.relay.mailchannels.net [23.83.209.27]) by sourceware.org (Postfix) with ESMTPS id BD6283858288 for ; Thu, 10 Aug 2023 17:06:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD6283858288 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 7CDC8C07A1; Thu, 10 Aug 2023 17:06:29 +0000 (UTC) Received: from pdx1-sub0-mail-a250.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B1CF9C17B1; Thu, 10 Aug 2023 17:06:28 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1691687189; a=rsa-sha256; cv=none; b=ZTYv5C6DJgSPphVEAM1ZjVo9lG+alr3BKBmmCsMSXz14Ul3PNeWyeodd8TB8ayVpRk7RkR bE0Zif7aO5UfxyIWZVDv82LIgF/h+pbaJ+ncs9lJnfe36i8iYUZAKPOT6NX/iWZPzpgnQO krEZHLOyDXzAkXyqsGw13pu8dwzlQliQ2X3BeLZerYXM6jDQ64UGgnNSB0nPexIkwu00L2 Okg/+p/NlzYD95kYmPr6rNQ2oR4crMkpsqm1byMoesurufznummXNrFi9auby77JOB4U5s xSnO/ihd4+ldvnmvexbZLkm1cW6BAL757kRNjeEjurHygQs503dOtbaaXTj/UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1691687189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc: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=VSpfKoM3rn+XY6cA6VjSFOVlIS5gbqoYPLvNkj48ewQ=; b=S+Ru7fSBMDmgPUY+nrNIILPJPlf/eu94h/Hmw4+Uca+bPhlS+1PVsYLtcBHOKzzFbUt+HW /PqA+yQam2/MPh6PIGmIqLCHB4HDgtR305V++d4s11z0XwOgxueS01y3wJ8m73VJgkzRIS nOxQe8oj0mG5s9LQn2CB9eWlmqoaD3m68FcZIa2LLWcp17UYB05oKAxhUDcYcf5Vpw0Ewq k4YWwP6/9H5qbdGIKor3YhKrtVKe06O/F03AlQ+Zm63V+HJzN0uTkkUprndp/dxWAh3JaG eACJyY+OJ+pADJJhYifDMOR05i/Ub+Aj5+Xfh0pECRK336zoIEaToWXmrYixaw== ARC-Authentication-Results: i=1; rspamd-749bd77c9c-rtl9q; 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-Fearful-Dime: 2cb1de131b9e801b_1691687189282_1621200074 X-MC-Loop-Signature: 1691687189282:3807624433 X-MC-Ingress-Time: 1691687189281 Received: from pdx1-sub0-mail-a250.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.125.117.202 (trex/6.9.1); Thu, 10 Aug 2023 17:06:29 +0000 Received: from [192.168.224.119] (unknown [24.114.69.242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a250.dreamhost.com (Postfix) with ESMTPSA id 4RMCxt31rkz87; Thu, 10 Aug 2023 10:06:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1691687188; bh=VSpfKoM3rn+XY6cA6VjSFOVlIS5gbqoYPLvNkj48ewQ=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=TDK3lhC5jVmVls/9Gmo+88gHtKeksJu3/AcsUzWe73JyXoOrkJk88VlVUDTaxdhAi dSQZz5fXWdpTmVRHmc2JUHl8/t1Nb0fEv6Y9yy8gwNpsyqj8w2AM3B8WXofEqP3c2e ZwKFTNyRAxMYux5cOOtP+944RqsmEuzhy1Du3F6/PvIP2afow7PPyG3IqSbkeROA5L w0nX5ti39lBxibT2x6/i3jqlwSPJ6Y640ZbafAUrAsZ9n81Ho1ATQYRwwHffRmFhZM H17T9nc1VjB0O3itjvF9/8bUyKlJInYYyQhGYaT6IN8RClj0mkRsMftx7z6KOkUoj1 Io8Zdx6wtPDYA== Message-ID: <43926f3a-fa91-07a4-dc6a-3d70784e3508@gotplt.org> Date: Thu, 10 Aug 2023 13:06:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [V2][PATCH 0/3] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Content-Language: en-US To: Jakub Jelinek Cc: Martin Uecker , Qing Zhao , Michael Matz , Kees Cook , Joseph Myers , Richard Biener , Qing Zhao via Gcc-patches , "isanbard@gmail.com" References: <3D502A20-7723-456B-8A29-3A4D1502CE74@oracle.com> <09e2fa3a43d3c0f909d4c8d455a9d2ccbac79fef.camel@gwdg.de> <0d943621-7c27-52b0-37f3-63cfd80e8f1b@gotplt.org> <23ab8c87-18fa-2237-62cf-2f4996af6f5e@gotplt.org> From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3031.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 2023-08-10 12:39, Jakub Jelinek wrote: > On Thu, Aug 10, 2023 at 12:30:06PM -0400, Siddhesh Poyarekar wrote: >> The definition of __bos/__bdos allows us the freedom to *estimate* rather >> than be precise, so I'd go for sizeof(x) + N * sizeof(*x.a) since it's bound >> to give the more conservative answer of the two. > > To be precise, we have the 0/1 modes vs. 2/3. So, when not determining > __bos/__bdos from actual allocation size or size of an stack object or > size of data section object but something else (say counted_by), perhaps > 0/1 modes should give the upper estimate of sizeof (x) + N * sizeof(elt) > and 2/3 modes should give a lower estimate, so offsetof + N * sizeof(elt), > then user code can continue testing if both modes are equal to have > exact number. Ack, that's fair. Thanks, Sid