public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	Martin Uecker <muecker@gwdg.de>, Michael Matz <matz@suse.de>,
	Kees Cook <keescook@chromium.org>,
	Joseph Myers <joseph@codesourcery.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org>,
	"isanbard@gmail.com" <isanbard@gmail.com>
Subject: Re: [V2][PATCH 0/3] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896)
Date: Thu, 10 Aug 2023 18:18:45 +0000	[thread overview]
Message-ID: <D6A1D359-0393-4099-9EE4-5565D3CB7C9B@oracle.com> (raw)
In-Reply-To: <ZNUSqgoSEArElb/g@tucnak>



> On Aug 10, 2023, at 12:39 PM, Jakub Jelinek <jakub@redhat.com> 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.

Yes, this sounds reasonable to me.

Qing
> 
> 	Jakub
> 


  parent reply	other threads:[~2023-08-10 18:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 19:44 Qing Zhao
2023-08-04 19:44 ` [V2][PATCH 1/3] Provide counted_by attribute to flexible array member field (PR108896) Qing Zhao
2023-08-04 19:44 ` [V2][PATCH 2/3] Use the counted_by atribute info in builtin object size [PR108896] Qing Zhao
2023-08-04 19:44 ` [V2][PATCH 3/3] Use the counted_by attribute information in bound sanitizer[PR108896] Qing Zhao
2023-08-07 16:16 ` [V2][PATCH 0/3] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Kees Cook
2023-08-07 16:33   ` Qing Zhao
2023-08-09 19:17     ` Kees Cook
2023-08-08 14:54   ` Martin Uecker
2023-08-08 16:18     ` Michael Matz
2023-08-08 19:58     ` Kees Cook
2023-08-09 16:05     ` Qing Zhao
2023-08-09 16:21       ` Michael Matz
2023-08-09 20:10         ` Qing Zhao
2023-08-10  6:58           ` Martin Uecker
2023-08-10 13:59             ` Qing Zhao
2023-08-10 14:38               ` Martin Uecker
2023-08-10 14:42                 ` Jakub Jelinek
2023-08-10 14:47                   ` Martin Uecker
2023-08-10 14:58                     ` Siddhesh Poyarekar
2023-08-10 15:18                       ` Martin Uecker
2023-08-10 16:28                         ` Qing Zhao
2023-08-10 16:30                         ` Siddhesh Poyarekar
2023-08-10 16:39                           ` Jakub Jelinek
2023-08-10 17:06                             ` Siddhesh Poyarekar
2023-08-16 21:42                               ` Qing Zhao
2023-08-10 18:18                             ` Qing Zhao [this message]
2023-08-10 14:02             ` Michael Matz
2023-08-10 13:54           ` Michael Matz
2023-08-09 20:34     ` Qing Zhao
2023-08-17  5:31 ` Kees Cook
2023-08-17  6:38   ` Kees Cook
2023-08-17 13:44     ` Qing Zhao
2023-08-17 16:54       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D6A1D359-0393-4099-9EE4-5565D3CB7C9B@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=isanbard@gmail.com \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=keescook@chromium.org \
    --cc=matz@suse.de \
    --cc=muecker@gwdg.de \
    --cc=richard.guenther@gmail.com \
    --cc=siddhesh@gotplt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).