[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFP8O3JO42CD2EXk+DJ5pci8ieHvRifAZpKg4iR_NiqTaYfLdA@mail.gmail.com>
Date: Fri, 26 May 2023 12:48:26 -0700
From: Fangrui Song <maskray@...gle.com>
To: Kees Cook <keescook@...omium.org>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, ojeda@...nel.org,
qing.zhao@...cle.com, morbo@...gle.com, llvm@...ts.linux.dev,
trix@...hat.com, linux-kernel@...r.kernel.org, nathan@...nel.org,
linux-hardening@...r.kernel.org, gustavoars@...nel.org,
ndesaulniers@...gle.com
Subject: Re: [PATCH v2] Compiler Attributes: Add __counted_by macro
On Fri, May 26, 2023 at 11:56 AM Kees Cook <keescook@...omium.org> wrote:
>
> On Fri, May 26, 2023 at 07:47:03PM +0200, Miguel Ojeda wrote:
> > On Fri, May 26, 2023 at 7:16 PM Kees Cook <keescook@...omium.org> wrote:
> > >
> > > FYI, applied to for-next/hardening:
> > >
> > > [1/1] Compiler Attributes: Add __counted_by macro
> > > https://git.kernel.org/kees/c/86a76e91cbab
> >
> > Sorry, I was going to apply it soon -- in case you want it:
> >
> > Acked-by: Miguel Ojeda <ojeda@...nel.org>
>
> Thanks!
>
> > And thanks Nathan for resubmitting the `Reviewed-by` from v1!
>
> Yes, apologies for missing this in my v2 submission!
>
> --
> Kees Cook
>
https://discourse.llvm.org/t/rfc-enforcing-bounds-safety-in-c-fbounds-safety/70854
proposes a macro __counted_by as well.
This patch uses the same name:
> # define __counted_by(member) __attribute__((__element_count__(member)))
I wonder whether the two use cases are compatible so that using the
same macro name will be fine.
#if defined(__has_feature) && __has_feature(bounds_safety)
#define __counted_by(T) __attribute__((__counted_by__(T)))
// ... other bounds annotations
#else
#define __counted_by(T) // defined as nothing // ... other bounds annotations
#endif
--
宋方睿
Powered by blists - more mailing lists