[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260130115438-465fb6a1-f414-4d69-b560-2304941464fc@linutronix.de>
Date: Fri, 30 Jan 2026 12:02:32 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Arnd Bergmann <arnd@...db.de>, Eric Dumazet <edumazet@...gle.com>,
Kuniyuki Iwashima <kuniyu@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Willem de Bruijn <willemb@...gle.com>, Xi Ruoyao <libc-alpha@...rceware.org>,
Carlos O'Donell <carlos@...hat.com>, Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>,
Rich Felker <dalias@...c.org>, Netdev <netdev@...r.kernel.org>, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, klibc@...or.com
Subject: Re: [klibc] [PATCH net-next] net: uapi: Provide an UAPI definition
of 'struct sockaddr'
On Tue, Jan 20, 2026 at 03:20:18PM -0800, H. Peter Anvin wrote:
> On 2026-01-20 14:31, Arnd Bergmann wrote:
> >>
> > I must have accidentally cut that from my reply, sorry.
> > Looking at it again now, I think I ran into problems with the
> > flexible array that was removed from the in-kernel sockaddr
> > structure in commit 2b5e9f9b7e41 ("net: Convert struct sockaddr
> > to fixed-size "sa_data[14]""), so there is a good chance it works
> > now with the (once more) fixed-size version.
> >
> > The other problem is that the structures that embed 'sockaddr'
> > are used a lot inside of the kernel, in particular in 'ifreq',
> > so changing the uapi sockaddr to __kernel_sockaddr requires
> > additional changes wherever the struct members are passed
> > by reference.
> >
>
> Well, the kernel should do what opting-in libcs do:
>
> #define sockaddr __kernel_sockaddr
This looks reasonable, but would only apply to future libc releases, no?
Adopting a new scheme for all types will be a larger undertaking. Today
'struct sockaddr' is the only type not using the current compatibility
mechanism. Could we first align 'struct sockaddr' as shown by the patch?
Whatever comes next can then build on a uniform base.
> or
>
> struct sockaddr { struct __kernel_sockaddr; };
>
> ... now when we have ms extensions turned on. Unfortunately gcc/clang don't
> support them without the option even with __extension__, so user space is
> limited to using macros.
Thomas
Powered by blists - more mailing lists