On Wed, 29 Oct 2025 14:43:57 -0700 Kees Cook wrote:
> The historically fixed-size struct sockaddr is part of UAPI and embedded
> in many existing structures. The kernel uses struct sockaddr extensively
> within the kernel to represent arbitrarily sized sockaddr structures,
> which caused problems with the compiler's ability to determine object
> sizes correctly. The "temporary" solution was to make sockaddr explicitly
> use a flexible array, but this causes problems for embedding struct
> sockaddr in structures, where once again the compiler has to guess about
> the size of such objects, and causes thousands of warnings under the
> coming -Wflex-array-member-not-at-end warning.
> 
> Switching to sockaddr_storage internally everywhere wastes a lot of memory,
> so we are left with needing two changes:
> - introduction of an explicitly arbitrarily sized sockaddr struct
> - switch struct sockaddr back to being fixed size
> 
> Doing the latter step requires all "arbitrarily sized" uses of struct
> sockaddr to be replaced with the new struct from the first step.
> 
> So, introduce the new struct and do enough conversions that we can
> switch sockaddr back to a fixed-size sa_data.

This doesn't apply to net-next.. Now I kinda wondering if maybe you
skipped a patch? The code itself LGTM.

Reply via email to