Re: [RFC][PATCH 1/2] locking: Introduce __cleanup__ based guards

From: Miguel Ojeda
Date: Fri May 26 2023 - 14:40:29 EST


On Fri, May 26, 2023 at 7:05 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> > --- a/include/linux/compiler_attributes.h
> > +++ b/include/linux/compiler_attributes.h
> > @@ -366,4 +366,6 @@
> > */
> > #define __fix_address noinline __noclone
> >
> > +#define __cleanup(func) __attribute__((__cleanup__(func)))
> > +
> > #endif /* __LINUX_COMPILER_ATTRIBUTES_H */
>
> nitpick: sorting. This needs to be moved up alphabetically; the comment
> at the start of the file says:
>
> ...
> * This file is meant to be sorted (by actual attribute name,
> * not by #define identifier). ...

+1, also please add:

/*
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-cleanup-variable-attribute
* clang: https://clang.llvm.org/docs/AttributeReference.html#cleanup
*/

Cheers,
Miguel