Re: [PATCH 0/5] Add __alloc_size() for better bounds checking

From: Christoph Hellwig
Date: Thu Aug 19 2021 - 05:10:21 EST


On Tue, Aug 17, 2021 at 10:08:36PM -0700, Kees Cook wrote:
> Hi,
>
> GCC and Clang both use the "alloc_size" attribute to assist with bounds
> checking around the use of allocation functions. Add the attribute,
> adjust the Makefile to silence needless warnings, and add the hints to
> the allocators where possible. These changes have been in use for a
> while now in GrapheneOS.

Can you explain how this attribute helps? Should we flow it through
other allocating functions?