* [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
@ 2026-01-20 14:10 Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones Thomas Weißschuh
` (4 more replies)
0 siblings, 5 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-20 14:10 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang,
Mickaël Salaün, Günther Noack, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Thomas Weißschuh
Various UAPI headers reference 'struct sockaddr'. Currently the
definition of this struct is pulled in from the libc header
sys/socket.h. This is problematic as it introduces a dependency
on a full userspace toolchain.
Add a definition of 'struct sockaddr' to the UAPI headers.
Before that, reorder some problematic header inclusions in the selftests.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Fix compilation failures in BPF samples and selftests
- Link to v1: https://lore.kernel.org/r/20260105-uapi-sockaddr-v1-1-b7653aba12a5@linutronix.de
---
Thomas Weißschuh (4):
selftests: net: Move some UAPI header inclusions after libc ones
selftests/landlock: Move some UAPI header inclusions after libc ones
samples/bpf: Move some UAPI header inclusions after libc ones
net: uapi: Provide an UAPI definition of 'struct sockaddr'
include/linux/socket.h | 10 ----------
include/uapi/linux/if.h | 4 ----
include/uapi/linux/libc-compat.h | 12 ++++++++++++
include/uapi/linux/socket.h | 14 ++++++++++++++
samples/bpf/xdp_adjust_tail_user.c | 6 ++++--
samples/bpf/xdp_fwd_user.c | 7 ++++---
samples/bpf/xdp_router_ipv4_user.c | 6 +++---
samples/bpf/xdp_sample_user.c | 15 ++++++++-------
samples/bpf/xdp_tx_iptunnel_user.c | 4 ++--
tools/testing/selftests/landlock/audit.h | 7 ++++---
tools/testing/selftests/net/af_unix/diag_uid.c | 9 +++++----
tools/testing/selftests/net/busy_poller.c | 3 ++-
tools/testing/selftests/net/mptcp/mptcp_diag.c | 11 ++++++-----
tools/testing/selftests/net/nettest.c | 4 ++--
tools/testing/selftests/net/tcp_ao/icmps-discard.c | 6 +++---
tools/testing/selftests/net/tcp_ao/lib/netlink.c | 9 +++++----
tools/testing/selftests/net/tun.c | 5 +++--
17 files changed, 77 insertions(+), 55 deletions(-)
---
base-commit: 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7
change-id: 20251222-uapi-sockaddr-cf10e7624729
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
@ 2026-01-20 14:10 ` Thomas Weißschuh
2026-01-26 18:13 ` Matthieu Baerts
2026-01-20 14:10 ` [PATCH net-next v2 2/4] selftests/landlock: " Thomas Weißschuh
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-20 14:10 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang,
Mickaël Salaün, Günther Noack, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Thomas Weißschuh
Interleaving inclusions of UAPI headers and libc headers is problematic.
Both sets of headers define conflicting symbols. To enable their
coexistence a compatibility-mechanism is in place.
An upcoming change will define 'struct sockaddr' from linux/socket.h.
However sys/socket.h from libc does not yet handle this case and a
symbol conflict will arise.
Furthermore libc-compat.h evaluates the state of the libc
inclusions only once, at the point it is included first. If another
problematic header from libc is included later, symbol conflicts arise.
This will trigger other duplicate definitions when linux/libc-compat.h
is added to linux/socket.h
Move the inclusion of UAPI headers after the inclusion of the glibc
ones, so the libc-compat.h continues to work correctly.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
tools/testing/selftests/net/af_unix/diag_uid.c | 9 +++++----
tools/testing/selftests/net/busy_poller.c | 3 ++-
tools/testing/selftests/net/mptcp/mptcp_diag.c | 11 ++++++-----
tools/testing/selftests/net/nettest.c | 4 ++--
tools/testing/selftests/net/tcp_ao/icmps-discard.c | 6 +++---
tools/testing/selftests/net/tcp_ao/lib/netlink.c | 9 +++++----
tools/testing/selftests/net/tun.c | 5 +++--
7 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/tools/testing/selftests/net/af_unix/diag_uid.c b/tools/testing/selftests/net/af_unix/diag_uid.c
index da7d50cedee6..05456a205325 100644
--- a/tools/testing/selftests/net/af_unix/diag_uid.c
+++ b/tools/testing/selftests/net/af_unix/diag_uid.c
@@ -5,15 +5,16 @@
#include <sched.h>
#include <unistd.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <linux/sock_diag.h>
-#include <linux/unix_diag.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/sock_diag.h>
+#include <linux/unix_diag.h>
+
#include "kselftest_harness.h"
FIXTURE(diag_uid)
diff --git a/tools/testing/selftests/net/busy_poller.c b/tools/testing/selftests/net/busy_poller.c
index 3a81f9c94795..34bd8d28808a 100644
--- a/tools/testing/selftests/net/busy_poller.c
+++ b/tools/testing/selftests/net/busy_poller.c
@@ -9,7 +9,6 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <ynl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -19,6 +18,8 @@
#include <sys/socket.h>
#include <sys/types.h>
+#include <ynl.h>
+
#include <linux/genetlink.h>
#include <linux/netlink.h>
diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
index 8e0b1b8d84b6..af25ebfd2915 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
@@ -1,11 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2025, Kylin Software */
-#include <linux/sock_diag.h>
-#include <linux/rtnetlink.h>
-#include <linux/inet_diag.h>
-#include <linux/netlink.h>
-#include <linux/compiler.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/tcp.h>
@@ -17,6 +12,12 @@
#include <errno.h>
#include <stdio.h>
+#include <linux/sock_diag.h>
+#include <linux/rtnetlink.h>
+#include <linux/inet_diag.h>
+#include <linux/netlink.h>
+#include <linux/compiler.h>
+
#ifndef IPPROTO_MPTCP
#define IPPROTO_MPTCP 262
#endif
diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c
index 1f5227f3d64d..71430403b50b 100644
--- a/tools/testing/selftests/net/nettest.c
+++ b/tools/testing/selftests/net/nettest.c
@@ -10,8 +10,6 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -30,6 +28,8 @@
#include <errno.h>
#include <getopt.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
#include <linux/xfrm.h>
#include <linux/ipsec.h>
#include <linux/pfkeyv2.h>
diff --git a/tools/testing/selftests/net/tcp_ao/icmps-discard.c b/tools/testing/selftests/net/tcp_ao/icmps-discard.c
index 85c1a1e958c6..451ba89914c9 100644
--- a/tools/testing/selftests/net/tcp_ao/icmps-discard.c
+++ b/tools/testing/selftests/net/tcp_ao/icmps-discard.c
@@ -16,12 +16,12 @@
* Author: Dmitry Safonov <dima@arista.com>
*/
#include <inttypes.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/ipv6.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <sys/socket.h>
+#include <linux/icmp.h>
+#include <linux/icmpv6.h>
+#include <linux/ipv6.h>
#include "aolib.h"
#include "../../../../include/linux/compiler.h"
diff --git a/tools/testing/selftests/net/tcp_ao/lib/netlink.c b/tools/testing/selftests/net/tcp_ao/lib/netlink.c
index 7f108493a29a..69a05820782a 100644
--- a/tools/testing/selftests/net/tcp_ao/lib/netlink.c
+++ b/tools/testing/selftests/net/tcp_ao/lib/netlink.c
@@ -1,14 +1,15 @@
// SPDX-License-Identifier: GPL-2.0
/* Original from tools/testing/selftests/net/ipsec.c */
-#include <linux/netlink.h>
-#include <linux/random.h>
-#include <linux/rtnetlink.h>
-#include <linux/veth.h>
#include <net/if.h>
#include <stdint.h>
#include <string.h>
#include <sys/socket.h>
+#include <linux/netlink.h>
+#include <linux/random.h>
+#include <linux/rtnetlink.h>
+#include <linux/veth.h>
+
#include "aolib.h"
#define MAX_PAYLOAD 2048
diff --git a/tools/testing/selftests/net/tun.c b/tools/testing/selftests/net/tun.c
index 0efc67b0357a..e6e4c52d538e 100644
--- a/tools/testing/selftests/net/tun.c
+++ b/tools/testing/selftests/net/tun.c
@@ -8,12 +8,13 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+
#include <linux/if.h>
#include <linux/if_tun.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
#include "kselftest_harness.h"
--
2.52.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v2 2/4] selftests/landlock: Move some UAPI header inclusions after libc ones
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones Thomas Weißschuh
@ 2026-01-20 14:10 ` Thomas Weißschuh
2026-01-20 21:46 ` Mickaël Salaün
2026-01-20 14:10 ` [PATCH net-next v2 3/4] samples/bpf: " Thomas Weißschuh
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-20 14:10 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang,
Mickaël Salaün, Günther Noack, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Thomas Weißschuh
Interleaving inclusions of UAPI headers and libc headers is problematic.
Both sets of headers define conflicting symbols. To enable their
coexistence a compatibility-mechanism is in place.
An upcoming change will define 'struct sockaddr' from linux/socket.h.
However sys/socket.h from libc does not yet handle this case and a
symbol conflict will arise.
Move the inclusion of all UAPI headers after the inclusion of the glibc
ones, so the compatibility mechanism from the UAPI headers is used.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
tools/testing/selftests/landlock/audit.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/landlock/audit.h b/tools/testing/selftests/landlock/audit.h
index 44eb433e9666..c12b16c690dc 100644
--- a/tools/testing/selftests/landlock/audit.h
+++ b/tools/testing/selftests/landlock/audit.h
@@ -7,9 +7,6 @@
#define _GNU_SOURCE
#include <errno.h>
-#include <linux/audit.h>
-#include <linux/limits.h>
-#include <linux/netlink.h>
#include <regex.h>
#include <stdbool.h>
#include <stdint.h>
@@ -20,6 +17,10 @@
#include <sys/time.h>
#include <unistd.h>
+#include <linux/audit.h>
+#include <linux/limits.h>
+#include <linux/netlink.h>
+
#include "kselftest.h"
#ifndef ARRAY_SIZE
--
2.52.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v2 3/4] samples/bpf: Move some UAPI header inclusions after libc ones
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 2/4] selftests/landlock: " Thomas Weißschuh
@ 2026-01-20 14:10 ` Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 4/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
2026-01-22 3:27 ` [PATCH net-next v2 0/4] " Jakub Kicinski
4 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-20 14:10 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang,
Mickaël Salaün, Günther Noack, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Thomas Weißschuh
Interleaving inclusions of UAPI headers and libc headers is problematic.
Both sets of headers define conflicting symbols. To enable their
coexistence a compatibility-mechanism is in place.
An upcoming change will define 'struct sockaddr' from linux/socket.h.
However sys/socket.h from libc does not yet handle this case and a
symbol conflict will arise.
Move the inclusion of all UAPI headers after the inclusion of the glibc
ones, so the compatibility mechanism from the UAPI headers is used.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
samples/bpf/xdp_adjust_tail_user.c | 6 ++++--
samples/bpf/xdp_fwd_user.c | 7 ++++---
samples/bpf/xdp_router_ipv4_user.c | 6 +++---
samples/bpf/xdp_sample_user.c | 15 ++++++++-------
samples/bpf/xdp_tx_iptunnel_user.c | 4 ++--
5 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/samples/bpf/xdp_adjust_tail_user.c b/samples/bpf/xdp_adjust_tail_user.c
index e9426bd65420..32d00405debc 100644
--- a/samples/bpf/xdp_adjust_tail_user.c
+++ b/samples/bpf/xdp_adjust_tail_user.c
@@ -5,8 +5,6 @@
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*/
-#include <linux/bpf.h>
-#include <linux/if_link.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
@@ -18,9 +16,13 @@
#include <netinet/ether.h>
#include <unistd.h>
#include <time.h>
+
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
+#include <linux/bpf.h>
+#include <linux/if_link.h>
+
#define STATS_INTERVAL_S 2U
#define MAX_PCKT_SIZE 600
diff --git a/samples/bpf/xdp_fwd_user.c b/samples/bpf/xdp_fwd_user.c
index 193b3b79b31f..ca55f3eac12a 100644
--- a/samples/bpf/xdp_fwd_user.c
+++ b/samples/bpf/xdp_fwd_user.c
@@ -11,9 +11,6 @@
* General Public License for more details.
*/
-#include <linux/bpf.h>
-#include <linux/if_link.h>
-#include <linux/limits.h>
#include <net/if.h>
#include <errno.h>
#include <stdio.h>
@@ -27,6 +24,10 @@
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
+#include <linux/bpf.h>
+#include <linux/if_link.h>
+#include <linux/limits.h>
+
static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
static int do_attach(int idx, int prog_fd, int map_fd, const char *name)
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 266fdd0b025d..2abc7d294251 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2017 Cavium, Inc.
*/
-#include <linux/bpf.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
@@ -25,6 +22,9 @@
#include <libgen.h>
#include <getopt.h>
#include <pthread.h>
+#include <linux/bpf.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
#include "xdp_sample_user.h"
#include "xdp_router_ipv4.skel.h"
diff --git a/samples/bpf/xdp_sample_user.c b/samples/bpf/xdp_sample_user.c
index 158682852162..d9aec2bd372c 100644
--- a/samples/bpf/xdp_sample_user.c
+++ b/samples/bpf/xdp_sample_user.c
@@ -7,13 +7,6 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
-#include <linux/ethtool.h>
-#include <linux/hashtable.h>
-#include <linux/if_link.h>
-#include <linux/jhash.h>
-#include <linux/limits.h>
-#include <linux/list.h>
-#include <linux/sockios.h>
#include <locale.h>
#include <math.h>
#include <net/if.h>
@@ -32,6 +25,14 @@
#include <time.h>
#include <unistd.h>
+#include <linux/ethtool.h>
+#include <linux/hashtable.h>
+#include <linux/if_link.h>
+#include <linux/jhash.h>
+#include <linux/limits.h>
+#include <linux/list.h>
+#include <linux/sockios.h>
+
#include "bpf_util.h"
#include "xdp_sample_user.h"
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
index 7e4b2f7108a6..e9503036d0a0 100644
--- a/samples/bpf/xdp_tx_iptunnel_user.c
+++ b/samples/bpf/xdp_tx_iptunnel_user.c
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2016 Facebook
*/
-#include <linux/bpf.h>
-#include <linux/if_link.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
@@ -16,6 +14,8 @@
#include <time.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
+#include <linux/bpf.h>
+#include <linux/if_link.h>
#include "bpf_util.h"
#include "xdp_tx_iptunnel_common.h"
--
2.52.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v2 4/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
` (2 preceding siblings ...)
2026-01-20 14:10 ` [PATCH net-next v2 3/4] samples/bpf: " Thomas Weißschuh
@ 2026-01-20 14:10 ` Thomas Weißschuh
2026-01-22 3:27 ` [PATCH net-next v2 0/4] " Jakub Kicinski
4 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-20 14:10 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang,
Mickaël Salaün, Günther Noack, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Thomas Weißschuh
Various UAPI headers reference 'struct sockaddr'. Currently the
definition of this struct is pulled in from the libc header
sys/socket.h. This is problematic as it introduces a dependency
on a full userspace toolchain.
Instead expose a custom but compatible definition of 'struct sockaddr'
in the UAPI headers. It is guarded by the libc compatibility
infrastructure to avoid potential conflicts.
The compatibility symbol won't be supported by glibc right away,
but right now __UAPI_DEF_IF_IFNAMSIZ is not supported either,
so including the libc headers before the UAPI headers is broken anyways.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
include/linux/socket.h | 10 ----------
include/uapi/linux/if.h | 4 ----
include/uapi/linux/libc-compat.h | 12 ++++++++++++
include/uapi/linux/socket.h | 14 ++++++++++++++
4 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index ec715ad4bf25..8363d4e0a044 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -28,16 +28,6 @@ extern void socket_seq_show(struct seq_file *seq);
typedef __kernel_sa_family_t sa_family_t;
-/*
- * 1003.1g requires sa_family_t and that sa_data is char.
- */
-
-/* Deprecated for in-kernel use. Use struct sockaddr_unsized instead. */
-struct sockaddr {
- sa_family_t sa_family; /* address family, AF_xxx */
- char sa_data[14]; /* 14 bytes of protocol address */
-};
-
/**
* struct sockaddr_unsized - Unspecified size sockaddr for callbacks
* @sa_family: Address family (AF_UNIX, AF_INET, AF_INET6, etc.)
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 797ba2c1562a..a4bc54196a07 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -25,10 +25,6 @@
#include <linux/socket.h> /* for "struct sockaddr" et al */
#include <linux/compiler.h> /* for "__user" et al */
-#ifndef __KERNEL__
-#include <sys/socket.h> /* for struct sockaddr. */
-#endif
-
#if __UAPI_DEF_IF_IFNAMSIZ
#define IFNAMSIZ 16
#endif /* __UAPI_DEF_IF_IFNAMSIZ */
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 0eca95ccb41e..13a06ce4e825 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -140,6 +140,13 @@
#endif /* _NETINET_IN_H */
+/* Definitions for socket.h */
+#if defined(_SYS_SOCKET_H)
+#define __UAPI_DEF_SOCKADDR 0
+#else
+#define __UAPI_DEF_SOCKADDR 1
+#endif
+
/* Definitions for xattr.h */
#if defined(_SYS_XATTR_H)
#define __UAPI_DEF_XATTR 0
@@ -221,6 +228,11 @@
#define __UAPI_DEF_IP6_MTUINFO 1
#endif
+/* Definitions for socket.h */
+#ifndef __UAPI_DEF_SOCKADDR
+#define __UAPI_DEF_SOCKADDR 1
+#endif
+
/* Definitions for xattr.h */
#ifndef __UAPI_DEF_XATTR
#define __UAPI_DEF_XATTR 1
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index d3fcd3b5ec53..35d7d5f4b1a8 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -2,6 +2,8 @@
#ifndef _UAPI_LINUX_SOCKET_H
#define _UAPI_LINUX_SOCKET_H
+#include <linux/libc-compat.h> /* for compatibility with glibc */
+
/*
* Desired design of maximum size and alignment (see RFC2553)
*/
@@ -26,6 +28,18 @@ struct __kernel_sockaddr_storage {
};
};
+/*
+ * 1003.1g requires sa_family_t and that sa_data is char.
+ */
+
+/* Deprecated for in-kernel use. Use struct sockaddr_unsized instead. */
+#if __UAPI_DEF_SOCKADDR
+struct sockaddr {
+ __kernel_sa_family_t sa_family; /* address family, AF_xxx */
+ char sa_data[14]; /* 14 bytes of protocol address */
+};
+#endif /* __UAPI_DEF_SOCKADDR */
+
#define SOCK_SNDBUF_LOCK 1
#define SOCK_RCVBUF_LOCK 2
--
2.52.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 2/4] selftests/landlock: Move some UAPI header inclusions after libc ones
2026-01-20 14:10 ` [PATCH net-next v2 2/4] selftests/landlock: " Thomas Weißschuh
@ 2026-01-20 21:46 ` Mickaël Salaün
0 siblings, 0 replies; 19+ messages in thread
From: Mickaël Salaün @ 2026-01-20 21:46 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Shuah Khan,
Matthieu Baerts, Mat Martineau, Geliang Tang, Günther Noack,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Stanislav Fomichev, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel, linux-api,
Arnd Bergmann, linux-kselftest, mptcp, linux-security-module, bpf,
libc-alpha, Carlos O'Donell, Adhemerval Zanella, Rich Felker,
klibc, Florian Weimer
On Tue, Jan 20, 2026 at 03:10:32PM +0100, Thomas Weißschuh wrote:
> Interleaving inclusions of UAPI headers and libc headers is problematic.
> Both sets of headers define conflicting symbols. To enable their
> coexistence a compatibility-mechanism is in place.
>
> An upcoming change will define 'struct sockaddr' from linux/socket.h.
> However sys/socket.h from libc does not yet handle this case and a
> symbol conflict will arise.
>
> Move the inclusion of all UAPI headers after the inclusion of the glibc
> ones, so the compatibility mechanism from the UAPI headers is used.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Mickaël Salaün <mic@digikod.net>
Thanks!
> ---
> tools/testing/selftests/landlock/audit.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/landlock/audit.h b/tools/testing/selftests/landlock/audit.h
> index 44eb433e9666..c12b16c690dc 100644
> --- a/tools/testing/selftests/landlock/audit.h
> +++ b/tools/testing/selftests/landlock/audit.h
> @@ -7,9 +7,6 @@
>
> #define _GNU_SOURCE
> #include <errno.h>
> -#include <linux/audit.h>
> -#include <linux/limits.h>
> -#include <linux/netlink.h>
> #include <regex.h>
> #include <stdbool.h>
> #include <stdint.h>
> @@ -20,6 +17,10 @@
> #include <sys/time.h>
> #include <unistd.h>
>
> +#include <linux/audit.h>
> +#include <linux/limits.h>
> +#include <linux/netlink.h>
> +
> #include "kselftest.h"
>
> #ifndef ARRAY_SIZE
>
> --
> 2.52.0
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
` (3 preceding siblings ...)
2026-01-20 14:10 ` [PATCH net-next v2 4/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
@ 2026-01-22 3:27 ` Jakub Kicinski
2026-01-30 10:34 ` Thomas Weißschuh
4 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-01-22 3:27 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Tue, 20 Jan 2026 15:10:30 +0100 Thomas Weißschuh wrote:
> Various UAPI headers reference 'struct sockaddr'. Currently the
> definition of this struct is pulled in from the libc header
> sys/socket.h. This is problematic as it introduces a dependency
> on a full userspace toolchain.
>
> Add a definition of 'struct sockaddr' to the UAPI headers.
> Before that, reorder some problematic header inclusions in the selftests.
> include/linux/socket.h | 10 ----------
> include/uapi/linux/if.h | 4 ----
> include/uapi/linux/libc-compat.h | 12 ++++++++++++
> include/uapi/linux/socket.h | 14 ++++++++++++++
> samples/bpf/xdp_adjust_tail_user.c | 6 ++++--
> samples/bpf/xdp_fwd_user.c | 7 ++++---
> samples/bpf/xdp_router_ipv4_user.c | 6 +++---
> samples/bpf/xdp_sample_user.c | 15 ++++++++-------
> samples/bpf/xdp_tx_iptunnel_user.c | 4 ++--
> tools/testing/selftests/landlock/audit.h | 7 ++++---
> tools/testing/selftests/net/af_unix/diag_uid.c | 9 +++++----
> tools/testing/selftests/net/busy_poller.c | 3 ++-
> tools/testing/selftests/net/mptcp/mptcp_diag.c | 11 ++++++-----
> tools/testing/selftests/net/nettest.c | 4 ++--
> tools/testing/selftests/net/tcp_ao/icmps-discard.c | 6 +++---
> tools/testing/selftests/net/tcp_ao/lib/netlink.c | 9 +++++----
> tools/testing/selftests/net/tun.c | 5 +++--
> 17 files changed, 77 insertions(+), 55 deletions(-)
Are all those selftests / samples getting broken by this patch set?
I understand that we should avoid libc dependencies in uAPI but at
least speaking for networking - building selftests without libc is..
not a practical proposition?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones
2026-01-20 14:10 ` [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones Thomas Weißschuh
@ 2026-01-26 18:13 ` Matthieu Baerts
2026-01-30 10:22 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Matthieu Baerts @ 2026-01-26 18:13 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha,
Carlos O'Donell, Adhemerval Zanella, Rich Felker, klibc,
Florian Weimer, Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni,
Willem de Bruijn, David S. Miller, Jakub Kicinski, Simon Horman,
Shuah Khan, Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa
Hi Thomas,
On 20/01/2026 15:10, Thomas Weißschuh wrote:
> Interleaving inclusions of UAPI headers and libc headers is problematic.
> Both sets of headers define conflicting symbols. To enable their
> coexistence a compatibility-mechanism is in place.
>
> An upcoming change will define 'struct sockaddr' from linux/socket.h.
> However sys/socket.h from libc does not yet handle this case and a
> symbol conflict will arise.
>
> Furthermore libc-compat.h evaluates the state of the libc
> inclusions only once, at the point it is included first. If another
> problematic header from libc is included later, symbol conflicts arise.
> This will trigger other duplicate definitions when linux/libc-compat.h
> is added to linux/socket.h
>
> Move the inclusion of UAPI headers after the inclusion of the glibc
> ones, so the libc-compat.h continues to work correctly.
Thank you for looking at this!
Here is my (late, sorry) review for the modifications related to MPTCP:
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> index 8e0b1b8d84b6..af25ebfd2915 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> @@ -1,11 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> /* Copyright (c) 2025, Kylin Software */
>
> -#include <linux/sock_diag.h>
> -#include <linux/rtnetlink.h>
> -#include <linux/inet_diag.h>
> -#include <linux/netlink.h>
> -#include <linux/compiler.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <linux/tcp.h>
There is a remaining one (linux/tcp.h) here that you might want to move
below too.
> @@ -17,6 +12,12 @@
> #include <errno.h>
> #include <stdio.h>
>
> +#include <linux/sock_diag.h>
> +#include <linux/rtnetlink.h>
> +#include <linux/inet_diag.h>
> +#include <linux/netlink.h>
> +#include <linux/compiler.h>
Note that I just noticed this is the only file from this directory where
the "includes" are not sorted by type and alphabetical order, see
pm_nl_ctl.c as an example. A bit of a detail, but if you plan to send a
v2, do you mind doing that too here while at it, please?
If not, I can look at that later, but better to avoid doing that in
parallel.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones
2026-01-26 18:13 ` Matthieu Baerts
@ 2026-01-30 10:22 ` Thomas Weißschuh
2026-01-30 10:39 ` Matthieu Baerts
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-30 10:22 UTC (permalink / raw)
To: Matthieu Baerts
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha
(trimmed the recipient list)
Hi Matt,
On Mon, Jan 26, 2026 at 07:13:50PM +0100, Matthieu Baerts wrote:
> On 20/01/2026 15:10, Thomas Weißschuh wrote:
> > Interleaving inclusions of UAPI headers and libc headers is problematic.
> > Both sets of headers define conflicting symbols. To enable their
> > coexistence a compatibility-mechanism is in place.
> >
> > An upcoming change will define 'struct sockaddr' from linux/socket.h.
> > However sys/socket.h from libc does not yet handle this case and a
> > symbol conflict will arise.
> >
> > Furthermore libc-compat.h evaluates the state of the libc
> > inclusions only once, at the point it is included first. If another
> > problematic header from libc is included later, symbol conflicts arise.
> > This will trigger other duplicate definitions when linux/libc-compat.h
> > is added to linux/socket.h
> >
> > Move the inclusion of UAPI headers after the inclusion of the glibc
> > ones, so the libc-compat.h continues to work correctly.
>
> Thank you for looking at this!
>
> Here is my (late, sorry) review for the modifications related to MPTCP:
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> > index 8e0b1b8d84b6..af25ebfd2915 100644
> > --- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> > @@ -1,11 +1,6 @@
> > // SPDX-License-Identifier: GPL-2.0
> > /* Copyright (c) 2025, Kylin Software */
> >
> > -#include <linux/sock_diag.h>
> > -#include <linux/rtnetlink.h>
> > -#include <linux/inet_diag.h>
> > -#include <linux/netlink.h>
> > -#include <linux/compiler.h>
> > #include <sys/socket.h>
> > #include <netinet/in.h>
> > #include <linux/tcp.h>
>
> There is a remaining one (linux/tcp.h) here that you might want to move
> below too.
Good point.
> > @@ -17,6 +12,12 @@
> > #include <errno.h>
> > #include <stdio.h>
> >
> > +#include <linux/sock_diag.h>
> > +#include <linux/rtnetlink.h>
> > +#include <linux/inet_diag.h>
> > +#include <linux/netlink.h>
> > +#include <linux/compiler.h>
>
> Note that I just noticed this is the only file from this directory where
> the "includes" are not sorted by type and alphabetical order, see
> pm_nl_ctl.c as an example. A bit of a detail, but if you plan to send a
> v2, do you mind doing that too here while at it, please?
I'll send a v3 during the next cycle.
> If not, I can look at that later, but better to avoid doing that in
> parallel.
If you want to fix this up already during this cycle,
that would also be most welcome.
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-22 3:27 ` [PATCH net-next v2 0/4] " Jakub Kicinski
@ 2026-01-30 10:34 ` Thomas Weißschuh
2026-01-30 16:17 ` Jakub Kicinski
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-30 10:34 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Wed, Jan 21, 2026 at 07:27:29PM -0800, Jakub Kicinski wrote:
> On Tue, 20 Jan 2026 15:10:30 +0100 Thomas Weißschuh wrote:
> > Various UAPI headers reference 'struct sockaddr'. Currently the
> > definition of this struct is pulled in from the libc header
> > sys/socket.h. This is problematic as it introduces a dependency
> > on a full userspace toolchain.
> >
> > Add a definition of 'struct sockaddr' to the UAPI headers.
> > Before that, reorder some problematic header inclusions in the selftests.
>
> > include/linux/socket.h | 10 ----------
> > include/uapi/linux/if.h | 4 ----
> > include/uapi/linux/libc-compat.h | 12 ++++++++++++
> > include/uapi/linux/socket.h | 14 ++++++++++++++
> > samples/bpf/xdp_adjust_tail_user.c | 6 ++++--
> > samples/bpf/xdp_fwd_user.c | 7 ++++---
> > samples/bpf/xdp_router_ipv4_user.c | 6 +++---
> > samples/bpf/xdp_sample_user.c | 15 ++++++++-------
> > samples/bpf/xdp_tx_iptunnel_user.c | 4 ++--
> > tools/testing/selftests/landlock/audit.h | 7 ++++---
> > tools/testing/selftests/net/af_unix/diag_uid.c | 9 +++++----
> > tools/testing/selftests/net/busy_poller.c | 3 ++-
> > tools/testing/selftests/net/mptcp/mptcp_diag.c | 11 ++++++-----
> > tools/testing/selftests/net/nettest.c | 4 ++--
> > tools/testing/selftests/net/tcp_ao/icmps-discard.c | 6 +++---
> > tools/testing/selftests/net/tcp_ao/lib/netlink.c | 9 +++++----
> > tools/testing/selftests/net/tun.c | 5 +++--
> > 17 files changed, 77 insertions(+), 55 deletions(-)
>
> Are all those selftests / samples getting broken by this patch set?
Yes.
Some of them get broken by the new 'struct sockaddr', but some others are
already broken just by the new transitive inclusion of libc-compat.h.
So any header starting to use the compatibility machinery may trigger breakage
in code including UAPI headers before libc header, even for completely new type
definitions which themselves would not conflict with libc.
> I understand that we should avoid libc dependencies in uAPI but at
> least speaking for networking - building selftests without libc is..
> not a practical proposition?
I am not sure I understand. Some sort of libc will always be necessary.
And as the selftests are intended to exercise the low-level kernel APIs,
even those not supported by libc, the UAPI headers will also be necessary.
There is nolibc (tools/include/nolibc/) which is using the UAPI headers in
most cases, and aims to be compatible. And can be and already is used for
selftests, but it will be too limited for all of the networking selftests.
(Disclaimer: I am maintaining nolibc)
My goal is *not* to make the different headers less compatible on purpose.
But by removing the existing dependencies we can now enforce the checks in
CONFIG_UAPI_HEADER_TEST to prevent any new ones from creeping in. Therefore
preventing compatiblity issues in any new UAPI.
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones
2026-01-30 10:22 ` Thomas Weißschuh
@ 2026-01-30 10:39 ` Matthieu Baerts
0 siblings, 0 replies; 19+ messages in thread
From: Matthieu Baerts @ 2026-01-30 10:39 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: netdev, linux-kernel, linux-api, Arnd Bergmann, linux-kselftest,
mptcp, linux-security-module, bpf, libc-alpha
Hi Thomas,
On 30/01/2026 11:22, Thomas Weißschuh wrote:
(...)
>> Note that I just noticed this is the only file from this directory where
>> the "includes" are not sorted by type and alphabetical order, see
>> pm_nl_ctl.c as an example. A bit of a detail, but if you plan to send a
>> v2, do you mind doing that too here while at it, please?
>
> I'll send a v3 during the next cycle.
Thanks!
>> If not, I can look at that later, but better to avoid doing that in
>> parallel.
>
> If you want to fix this up already during this cycle,
> that would also be most welcome.
Sure, I can do that.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-30 10:34 ` Thomas Weißschuh
@ 2026-01-30 16:17 ` Jakub Kicinski
2026-01-31 10:26 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-01-30 16:17 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Fri, 30 Jan 2026 11:34:15 +0100 Thomas Weißschuh wrote:
> > Are all those selftests / samples getting broken by this patch set?
>
> Yes.
>
> Some of them get broken by the new 'struct sockaddr', but some others are
> already broken just by the new transitive inclusion of libc-compat.h.
> So any header starting to use the compatibility machinery may trigger breakage
> in code including UAPI headers before libc header, even for completely new type
> definitions which themselves would not conflict with libc.
Let's split the uAPI header changes from any selftest changes.
If you're saying the the selftests no longer build after the uAPI
header changes then of course we can't apply the patches.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-30 16:17 ` Jakub Kicinski
@ 2026-01-31 10:26 ` Thomas Weißschuh
2026-01-31 17:25 ` Jakub Kicinski
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-01-31 10:26 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
Jan 30, 2026 17:17:46 Jakub Kicinski <kuba@kernel.org>:
> On Fri, 30 Jan 2026 11:34:15 +0100 Thomas Weißschuh wrote:
>>> Are all those selftests / samples getting broken by this patch set?
>>
>> Yes.
>>
>> Some of them get broken by the new 'struct sockaddr', but some others are
>> already broken just by the new transitive inclusion of libc-compat.h.
>> So any header starting to use the compatibility machinery may trigger breakage
>> in code including UAPI headers before libc header, even for completely new type
>> definitions which themselves would not conflict with libc.
>
> Let's split the uAPI header changes from any selftest changes.
> If you're saying the the selftests no longer build after the uAPI
> header changes then of course we can't apply the patches.
Yes, the selftests don't build anymore after the uAPI changes.
"can't apply" as in
* "can't apply separately"
* "are unacceptable in general"
* "are too late for this cycle"
?
None of this is urgent.
We can do the selftests in one cycle and the uAPI in another one.
Feel free to pick up the patches as you see fit.
(The mptcp changes already go through their tree, so need to be dropped here)
I can also resubmit the patches differently if preferred.
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-31 10:26 ` Thomas Weißschuh
@ 2026-01-31 17:25 ` Jakub Kicinski
2026-02-03 11:42 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-01-31 17:25 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Sat, 31 Jan 2026 11:26:32 +0100 Thomas Weißschuh wrote:
> Jan 30, 2026 17:17:46 Jakub Kicinski <kuba@kernel.org>:
>
> > On Fri, 30 Jan 2026 11:34:15 +0100 Thomas Weißschuh wrote:
> >> Some of them get broken by the new 'struct sockaddr', but some others are
> >> already broken just by the new transitive inclusion of libc-compat.h.
> >> So any header starting to use the compatibility machinery may trigger breakage
> >> in code including UAPI headers before libc header, even for completely new type
> >> definitions which themselves would not conflict with libc.
> >
> > Let's split the uAPI header changes from any selftest changes.
> > If you're saying the the selftests no longer build after the uAPI
> > header changes then of course we can't apply the patches.
>
> Yes, the selftests don't build anymore after the uAPI changes.
>
> "can't apply" as in
> * "can't apply separately"
> * "are unacceptable in general"
this one
> * "are too late for this cycle"
> ?
>
> None of this is urgent.
> We can do the selftests in one cycle and the uAPI in another one.
> Feel free to pick up the patches as you see fit.
> (The mptcp changes already go through their tree, so need to be dropped here)
> I can also resubmit the patches differently if preferred.
The selftests are just a canary in the coalmine. If we break a bunch of
selftests chances are we'll also break compilation of real applications
for people. Subjective, but I don't see a sufficient upside here to do
that.
FWIW the typelimits change broke compilation of ethtool, we'll see if
anyone "outside kernel community itself" complains.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-01-31 17:25 ` Jakub Kicinski
@ 2026-02-03 11:42 ` Thomas Weißschuh
2026-02-03 22:40 ` Jakub Kicinski
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-02-03 11:42 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Sat, Jan 31, 2026 at 09:25:17AM -0800, Jakub Kicinski wrote:
> On Sat, 31 Jan 2026 11:26:32 +0100 Thomas Weißschuh wrote:
> > Jan 30, 2026 17:17:46 Jakub Kicinski <kuba@kernel.org>:
> >
> > > On Fri, 30 Jan 2026 11:34:15 +0100 Thomas Weißschuh wrote:
> > >> Some of them get broken by the new 'struct sockaddr', but some others are
> > >> already broken just by the new transitive inclusion of libc-compat.h.
> > >> So any header starting to use the compatibility machinery may trigger breakage
> > >> in code including UAPI headers before libc header, even for completely new type
> > >> definitions which themselves would not conflict with libc.
> > >
> > > Let's split the uAPI header changes from any selftest changes.
> > > If you're saying the the selftests no longer build after the uAPI
> > > header changes then of course we can't apply the patches.
> >
> > Yes, the selftests don't build anymore after the uAPI changes.
> >
> > "can't apply" as in
> > * "can't apply separately"
> > * "are unacceptable in general"
>
> this one
>
> > * "are too late for this cycle"
> > ?
> >
> > None of this is urgent.
> > We can do the selftests in one cycle and the uAPI in another one.
> > Feel free to pick up the patches as you see fit.
> > (The mptcp changes already go through their tree, so need to be dropped here)
> > I can also resubmit the patches differently if preferred.
>
> The selftests are just a canary in the coalmine. If we break a bunch of
> selftests chances are we'll also break compilation of real applications
> for people. Subjective, but I don't see a sufficient upside here to do
> that.
Okay. We'll have around this inconsistency then.
> FWIW the typelimits change broke compilation of ethtool, we'll see if
> anyone "outside kernel community itself" complains.
Can you point me to that breakage? I was unable to find it.
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-02-03 11:42 ` Thomas Weißschuh
@ 2026-02-03 22:40 ` Jakub Kicinski
2026-02-04 5:51 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-02-03 22:40 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Tue, 3 Feb 2026 12:42:22 +0100 Thomas Weißschuh wrote:
> > FWIW the typelimits change broke compilation of ethtool, we'll see if
> > anyone "outside kernel community itself" complains.
>
> Can you point me to that breakage? I was unable to find it.
Not reported on the ML, and it's kinda annoying to repro because
the uAPI header sync script isn't committed :/ You have to check
this out
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/
and run a script like this to sync headers from the kernel (then build):
#!/bin/bash -e
sn="${0##*/}"
export ARCH="x86_64"
if [ ! -d "$LINUX_GIT" ]; then
echo "${sn}: LINUX_GIT not set" >&2
exit 1
fi
pushd "$LINUX_GIT"
if [ -n "$1" ]; then
git checkout "$1"
fi
desc=$(git describe --exact-match 2>/dev/null \
|| git show -s --abbrev=12 --pretty='commit %h')
kobj=$(mktemp -d)
make -j16 O="$kobj" allmodconfig
make -j16 O="$kobj" prepare
make -j16 O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
popd
pushd uapi
find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
popd
rm -rf "$kobj"
git add uapi
git commit -s -F - <<EOT
update UAPI header copies
Update to kernel ${desc}.
EOT
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-02-03 22:40 ` Jakub Kicinski
@ 2026-02-04 5:51 ` Thomas Weißschuh
2026-02-05 1:55 ` Jakub Kicinski
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2026-02-04 5:51 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Tue, Feb 03, 2026 at 02:40:11PM -0800, Jakub Kicinski wrote:
> On Tue, 3 Feb 2026 12:42:22 +0100 Thomas Weißschuh wrote:
> > > FWIW the typelimits change broke compilation of ethtool, we'll see if
> > > anyone "outside kernel community itself" complains.
> >
> > Can you point me to that breakage? I was unable to find it.
>
> Not reported on the ML, and it's kinda annoying to repro because
> the uAPI header sync script isn't committed :/ You have to check
> this out
>
> https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/
>
> and run a script like this to sync headers from the kernel (then build):
>
> #!/bin/bash -e
>
> sn="${0##*/}"
> export ARCH="x86_64"
>
> if [ ! -d "$LINUX_GIT" ]; then
> echo "${sn}: LINUX_GIT not set" >&2
> exit 1
> fi
>
> pushd "$LINUX_GIT"
> if [ -n "$1" ]; then
> git checkout "$1"
> fi
> desc=$(git describe --exact-match 2>/dev/null \
> || git show -s --abbrev=12 --pretty='commit %h')
> kobj=$(mktemp -d)
> make -j16 O="$kobj" allmodconfig
> make -j16 O="$kobj" prepare
These are not necessary.
The UAPI generation does not need a kernel configuration.
> make -j16 O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
> popd
>
> pushd uapi
> find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
Here only those headers which already exist in ethtool's uapi/ directory
are copied. As linux/typelimits.h is new, it is now missing.
Honestly, if a user fiddles with the internals of the UAPI headers like
this, it is on them to update their code if the internal structure
changes. In your case a simple 'touch uapi/linux/typelimits.h'
before running the script will be enough. Also internal.h now requires
an explicit inclusion of <limits.h>, as that is not satisfied by the
UAPI anymore.
> popd
> rm -rf "$kobj"
>
> git add uapi
> git commit -s -F - <<EOT
> update UAPI header copies
>
> Update to kernel ${desc}.
>
> EOT
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-02-04 5:51 ` Thomas Weißschuh
@ 2026-02-05 1:55 ` Jakub Kicinski
2026-02-09 13:34 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-02-05 1:55 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Wed, 4 Feb 2026 06:51:46 +0100 Thomas Weißschuh wrote:
> > make -j16 O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
> > popd
> >
> > pushd uapi
> > find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
>
> Here only those headers which already exist in ethtool's uapi/ directory
> are copied. As linux/typelimits.h is new, it is now missing.
> Honestly, if a user fiddles with the internals of the UAPI headers like
> this, it is on them to update their code if the internal structure
> changes. In your case a simple 'touch uapi/linux/typelimits.h'
> before running the script will be enough. Also internal.h now requires
> an explicit inclusion of <limits.h>, as that is not satisfied by the
> UAPI anymore.
Hopefully you understand that while due to uapi header copy this is not
a huge issue for ethtool itself, but it is a proof that your changes
can break normal user space applications which do not vendor in uapi.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr'
2026-02-05 1:55 ` Jakub Kicinski
@ 2026-02-09 13:34 ` Thomas Weißschuh
0 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2026-02-09 13:34 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Shuah Khan, Matthieu Baerts,
Mat Martineau, Geliang Tang, Mickaël Salaün,
Günther Noack, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, netdev, linux-kernel,
linux-api, Arnd Bergmann, linux-kselftest, mptcp,
linux-security-module, bpf, libc-alpha, Carlos O'Donell,
Adhemerval Zanella, Rich Felker, klibc, Florian Weimer
On Wed, Feb 04, 2026 at 05:55:16PM -0800, Jakub Kicinski wrote:
> On Wed, 4 Feb 2026 06:51:46 +0100 Thomas Weißschuh wrote:
> > > make -j16 O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
> > > popd
> > >
> > > pushd uapi
> > > find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
> >
> > Here only those headers which already exist in ethtool's uapi/ directory
> > are copied. As linux/typelimits.h is new, it is now missing.
> > Honestly, if a user fiddles with the internals of the UAPI headers like
> > this, it is on them to update their code if the internal structure
> > changes. In your case a simple 'touch uapi/linux/typelimits.h'
> > before running the script will be enough. Also internal.h now requires
> > an explicit inclusion of <limits.h>, as that is not satisfied by the
> > UAPI anymore.
>
> Hopefully you understand that while due to uapi header copy this is not
> a huge issue for ethtool itself, but it is a proof that your changes
> can break normal user space applications which do not vendor in uapi.
A regular application which uses a full UAPI headers tree will get
access to the new header automatically.
If the application uses symbols from <limits.h> without including <limits.h>
on its own, it is broken.
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2026-02-09 13:34 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 14:10 [PATCH net-next v2 0/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones Thomas Weißschuh
2026-01-26 18:13 ` Matthieu Baerts
2026-01-30 10:22 ` Thomas Weißschuh
2026-01-30 10:39 ` Matthieu Baerts
2026-01-20 14:10 ` [PATCH net-next v2 2/4] selftests/landlock: " Thomas Weißschuh
2026-01-20 21:46 ` Mickaël Salaün
2026-01-20 14:10 ` [PATCH net-next v2 3/4] samples/bpf: " Thomas Weißschuh
2026-01-20 14:10 ` [PATCH net-next v2 4/4] net: uapi: Provide an UAPI definition of 'struct sockaddr' Thomas Weißschuh
2026-01-22 3:27 ` [PATCH net-next v2 0/4] " Jakub Kicinski
2026-01-30 10:34 ` Thomas Weißschuh
2026-01-30 16:17 ` Jakub Kicinski
2026-01-31 10:26 ` Thomas Weißschuh
2026-01-31 17:25 ` Jakub Kicinski
2026-02-03 11:42 ` Thomas Weißschuh
2026-02-03 22:40 ` Jakub Kicinski
2026-02-04 5:51 ` Thomas Weißschuh
2026-02-05 1:55 ` Jakub Kicinski
2026-02-09 13:34 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox