]> git.ipfire.org Git - thirdparty/linux.git/commit
Merge branch 'net-introduce-struct-sockaddr_unsized'
authorJakub Kicinski <kuba@kernel.org>
Wed, 5 Nov 2025 03:10:35 +0000 (19:10 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 5 Nov 2025 03:10:36 +0000 (19:10 -0800)
commit89aec171d9d1ab168e43fcf9754b82e4c0aef9b9
tree8e72511780bc69941e51a54cfa126f0e9538347a
parentbd0fa860730861bd6482b7acc5d39fd1e15c7453
parent2b5e9f9b7e414c5eeb20dd7a7b80816ff55cf57b
Merge branch 'net-introduce-struct-sockaddr_unsized'

Kees Cook says:

====================
net: Introduce struct sockaddr_unsized

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.
====================

Link: https://patch.msgid.link/20251104002608.do.383-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>