Re: [PATCH 11/12] slab: Remove __malloc attribute from realloc functions

2022-09-22 Thread Miguel Ojeda
On Thu, Sep 22, 2022 at 5:56 PM Kees Cook wrote: > > I wasn't sure if this "composite macro" was sane there, especially since > it would be using __malloc before it was defined, etc. Would you prefer > I move it? Hmm... On one hand, they end up being attributes, so it could make sense to have the

Re: [PATCH 11/12] slab: Remove __malloc attribute from realloc functions

2022-09-22 Thread Kees Cook
On Thu, Sep 22, 2022 at 11:23:46AM +0200, Miguel Ojeda wrote: > On Thu, Sep 22, 2022 at 5:10 AM Kees Cook wrote: > > > > -#ifdef __alloc_size__ > > -# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > > -#else > > -# define __alloc_size(x, ...) __malloc > > -#endif > > +#d

Re: [PATCH 11/12] slab: Remove __malloc attribute from realloc functions

2022-09-22 Thread Miguel Ojeda
On Thu, Sep 22, 2022 at 5:10 AM Kees Cook wrote: > > -#ifdef __alloc_size__ > -# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > -#else > -# define __alloc_size(x, ...) __malloc > -#endif > +#define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > +#de

[PATCH 11/12] slab: Remove __malloc attribute from realloc functions

2022-09-21 Thread Kees Cook
The __malloc attribute should not be applied to "realloc" functions, as the returned pointer may alias the storage of the prior pointer. Instead of splitting __malloc from __alloc_size, which would be a huge amount of churn, just create __realloc_size for the few cases where it is needed. Addition