[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202511040858.9084011BB@keescook>
Date: Tue, 4 Nov 2025 08:59:43 -0800
From: Kees Cook <kees@...nel.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Simon Horman <horms@...nel.org>,
Kuniyuki Iwashima <kuniyu@...gle.com>,
Willem de Bruijn <willemb@...gle.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH net-next v5 1/8] net: Add struct sockaddr_unsized for
sockaddr of unknown length
On Tue, Nov 04, 2025 at 09:15:36AM +0000, David Laight wrote:
> On Mon, 3 Nov 2025 16:26:09 -0800
> Kees Cook <kees@...nel.org> wrote:
>
> > Add flexible sockaddr structure to support addresses longer than the
> > traditional 14-byte struct sockaddr::sa_data limitation without
> > requiring the full 128-byte sa_data of struct sockaddr_storage. This
> > allows the network APIs to pass around a pointer to an object that
> > isn't lying to the compiler about how big it is, but must be accompanied
> > by its actual size as an additional parameter.
> >
> > It's possible we may way to migrate to including the size with the
> > struct in the future, e.g.:
> >
> > struct sockaddr_unsized {
> > u16 sa_data_len;
> > u16 sa_family;
> > u8 sa_data[] __counted_by(sa_data_len);
> > };
>
> I'm not sure having that example helps.
> At a quick glance it might be thought of as part of the change.
> That particular example also has all sorts of issues, so any such
> change would have to be very different.
That's fine, we can drop the example and the sentence introducing it. If
a v6 is desired, let me know.
--
Kees Cook
Powered by blists - more mailing lists