Re: [PATCH 1/5] Compiler Attributes: Add __alloc_size() for better bounds checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 18, 2021 at 11:04:32AM -0700, Nathan Chancellor wrote:
> On 8/17/2021 10:08 PM, Kees Cook wrote:
> > GCC and Clang can use the alloc_size attribute to better inform the
> > results of __builtin_object_size() (for compile-time constant values).
> > Clang can additionally use alloc_size to informt the results of
> > __builtin_dynamic_object_size() (for run-time values).
> > 
> > Additionally disables -Wno-alloc-size-larger-than since the allocators
> > already reject SIZE_MAX, and the compile-time warnings aren't helpful.
> 
> In addition to what Miguel said, it might be helpful to mention that this
> warning is GCC specific, I was a little confused at first as to why it was
> just being added in the GCC only block :)

Yes, good point. I'll call it out in particular.

> Otherwise, the attribute addition looks good to me. I will add my tag on v2.

Thanks!

-- 
Kees Cook



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux