From: Simon Horman <horms@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Xin Long <lucien.xin@gmail.com>,
linux-kernel@vger.kernel.org, wireguard@lists.zx2c4.com,
netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
linux-hardening@vger.kernel.org,
Kuniyuki Iwashima <kuniyu@amazon.com>,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 0/3] net: Add sockaddr_inet unified address structure
Date: Wed, 23 Jul 2025 16:46:47 +0100 [thread overview]
Message-ID: <20250723154647.GI1036606@horms.kernel.org> (raw)
In-Reply-To: <20250722171528.work.209-kees@kernel.org>
+ Iwashima-san and Willem
This series looks like something you should review
On Tue, Jul 22, 2025 at 10:18:30AM -0700, Kees Cook wrote:
> Hi!
>
> Repeating patch 1, as it has the rationale:
>
> There are cases in networking (e.g. wireguard, sctp) where a union is
> used to provide coverage for either IPv4 or IPv6 network addresses,
> and they include an embedded "struct sockaddr" as well (for "sa_family"
> and raw "sa_data" access). The current struct sockaddr contains a
> flexible array, which means these unions should not be further embedded
> in other structs because they do not technically have a fixed size (and
> are generating warnings for the coming -Wflexible-array-not-at-end flag
> addition). But the future changes to make struct sockaddr a fixed size
> (i.e. with a 14 byte sa_data member) make the "sa_data" uses with an IPv6
> address a potential place for the compiler to get upset about object size
> mismatches. Therefore, we need a sockaddr that cleanly provides both an
> sa_family member and an appropriately fixed-sized sa_data member that does
> not bloat member usage via the potential alternative of sockaddr_storage
> to cover both IPv4 and IPv6, to avoid unseemly churn in the affected code
> bases.
>
> Introduce sockaddr_inet as a unified structure for holding both IPv4 and
> IPv6 addresses (i.e. large enough to accommodate sockaddr_in6).
>
> The structure is defined in linux/in6.h since its max size is sized
> based on sockaddr_in6 and provides a more specific alternative to the
> generic sockaddr_storage for IPv4 with IPv6 address family handling.
>
> The "sa_family" member doesn't use the sa_family_t type to avoid needing
> layer violating header inclusions.
>
> Also includes the replacements for wireguard and sctp.
>
> Thanks,
>
> -Kees
>
> Kees Cook (3):
> ipv6: Add sockaddr_inet unified address structure
> wireguard: peer: Replace sockaddr with sockaddr_inet
> sctp: Replace sockaddr with sockaddr_inet in sctp_addr union
>
> drivers/net/wireguard/peer.h | 2 +-
> include/linux/in6.h | 7 +++++++
> include/net/sctp/structs.h | 2 +-
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-07-23 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 17:18 [PATCH net-next 0/3] net: Add sockaddr_inet unified address structure Kees Cook
2025-07-22 17:18 ` [PATCH net-next 1/3] ipv6: " Kees Cook
2025-07-22 17:18 ` [PATCH net-next 2/3] wireguard: peer: Replace sockaddr with sockaddr_inet Kees Cook
2025-07-22 17:18 ` [PATCH net-next 3/3] sctp: Replace sockaddr with sockaddr_inet in sctp_addr union Kees Cook
2025-07-23 15:46 ` Simon Horman [this message]
2025-07-25 23:26 ` [PATCH net-next 0/3] net: Add sockaddr_inet unified address structure patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250723154647.GI1036606@horms.kernel.org \
--to=horms@kernel.org \
--cc=Jason@zx2c4.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.