net: Disallow buggy TCP transitions and IPV6_ADDRFORM.
Subsystems (6)
Kuniyuki Iwashima
maintainercover net: Disallow buggy TCP transitions and IPV6_ADDRFORM.
The following operations have recently received a lot of AI-driven bug reports:
* listen() + shutdown() + connect()
* connect() + connect(AF_UNSPEC) + listen()
* setsockopt(IPV6_ADDRFORM)
They are not worth fixing by churning the fast path, so this series disallows the transitions and removes IPV6_ADDRFORM.
https://lore.kernel.org/netdev/CANn89i+px52TtJy3S9=uHxGj3s-WueguRo1Z_4FxO=02KLmwmQ@mail.gmail.com/
https://lore.kernel.org/netdev/[email protected]/
I did not add Fixes tags, but if we want to backport, the tag would be:
Kuniyuki Iwashima (2):
tcp: Do not allow buggy transitions between ehash and lhash2.
ipv6: Remove IPV6_ADDRFORM.
include/linux/net.h | 2 +- include/net/inet_connection_sock.h | 1 + net/core/sock.c | 4 +- net/ipv4/af_inet.c | 3 -- net/ipv4/inet_connection_sock.c | 1 + net/ipv4/inet_hashtables.c | 11 ++++ net/ipv6/af_inet6.c | 4 -- net/ipv6/ipv6_sockglue.c | 87 ------------------------------ 8 files changed, 15 insertions(+), 98 deletions(-)
Signature · 1 line
2.55.0.1003.g10538fe699-goog
Kuniyuki Iwashima
maintainerPATCH 1/2 tcp: Do not allow buggy transitions between ehash and lhash2.
The following state transitions have long been a playground for syzbot, and recently AI joined in, reporting a lot more bugs.
* listen() + shutdown() + connect()
* connect() + connect(AF_UNSPEC) + listen()
All the fix attempts would add more code to the fast path, which is not worth it.
Instead of playing whack-a-mole with these edge-case bugs, let's disallow these transitions.
Note that unhashed_state is placed in the 4-byte hole after icsk_pmtu_cookie.
$ pahole -C inet_connection_sock vmlinux
struct inet_connection_sock {
...
__u32 icsk_pmtu_cookie; /* 1208 4 */
unsigned char unhashed_state; /* 1212 1 *//* XXX 3 bytes hole, try to pack */
--- include/net/inet_connection_sock.h | 1 + net/ipv4/inet_connection_sock.c | 1 + net/ipv4/inet_hashtables.c | 11 +++++++++++ 3 files changed, 13 insertions(+)
include/net/inet_connection_sock.h +1 -0
@@ -94,6 +94,7 @@ struct inet_connection_sock {u32 icsk_rto_max;__u32 icsk_delack_max;__u32 icsk_pmtu_cookie; +unsigned char unhashed_state;const struct tcp_congestion_ops *icsk_ca_ops;const struct inet_connection_sock_af_ops *icsk_af_ops;const struct tcp_ulp_ops *icsk_ulp_ops;
net/ipv4/inet_connection_sock.c +1 -0
@@ -1253,6 +1253,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,memset (&newicsk->icsk_accept_queue,0 ,sizeof (newicsk->icsk_accept_queue)); + newicsk->unhashed_state =0 ;inet_sk_set_state (newsk,TCP_SYN_RECV );inet_clone_ulp (req, newsk, priority);
net/ipv4/inet_hashtables.c +11 -0
@@ -803,6 +803,11 @@ int inet_hash(struct sock *sk)inet_init_ehash_secret ();WARN_ON (!sk_unhashed (sk)); + +if (unlikely (inet_csk (sk)->unhashed_state && +inet_csk (sk)->unhashed_state !=TCP_LISTEN )) +return -EINVAL ; + ilb2 =inet_lhash2_bucket_sk (hashinfo, sk);spin_lock (&ilb2->lock);
@@ -832,6 +837,9 @@ void inet_unhash(struct sock *sk)return ;sock_rps_delete_flow (sk); + +inet_csk (sk)->unhashed_state = sk->sk_state; +if (sk->sk_state ==TCP_LISTEN ) {struct inet_listen_hashbucket *ilb2;
@@ -1058,6 +1066,9 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,int ret, i, low, high;bool local_ports; +if (unlikely (inet_csk (sk)->unhashed_state ==TCP_LISTEN )) +return -EINVAL ; +if (port) {local_bh_disable (); ret = check_established(death_row, sk, port, NULL, false,
Signature · 1 line
2.55.0.1003.g10538fe699-goog
Kuniyuki Iwashima
maintainerPATCH 2/2 ipv6: Remove IPV6_ADDRFORM.
In reply to Kuniyuki IwashimaRecently, IPV6_ADDRFORM has received many AI-driven bug reports. Fixing them properly would needlessly churn the fast paths in TCP and UDP.
IPV6_ADDRFORM was initially introduced in RFC 2133 in 1997, but only two years later, it was removed from RFC 2553 in 1999.
In 2026, modern applications natively support dual-stack sockets; notably, systemd's socket activation does not use IPV6_ADDRFORM.
Also, getsockopt(IPV6_ADDRFORM) can be replaced with SO_DOMAIN.
Let's remove IPV6_ADDRFORM.
Later, we can remove sk->sk_prot_creator and revert commit c26c192c3d48 ("udp: properly deal with xfrm encap and ADDRFORM").
--- include/linux/net.h | 2 +- net/core/sock.c | 4 +- net/ipv4/af_inet.c | 3 -- net/ipv6/af_inet6.c | 4 -- net/ipv6/ipv6_sockglue.c | 87 ---------------------------------------- 5 files changed, 2 insertions(+), 98 deletions(-)
include/linux/net.h +1 -1
@@ -166,7 +166,7 @@ struct socket {struct file *file;struct sock *sk; -const struct proto_ops *ops;/* Might change with IPV6_ADDRFORM or MPTCP. */ +const struct proto_ops *ops;/* Might change with MPTCP. */ struct socket_wq wq; };
net/core/sock.c +1 -3
@@ -770,7 +770,7 @@ bool sk_mc_loop(const struct sock *sk)return false;if (!sk)return true; -/* IPV6_ADDRFORM can change sk->sk_family under us. */ +switch (READ_ONCE (sk->sk_family)) {case AF_INET :return inet_test_bit (MC_LOOP , sk);
@@ -4010,7 +4010,6 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ return READ_ONCE (sk->sk_prot)->getsockopt (sk, level, optname, optval, optlen); }EXPORT_SYMBOL (sock_common_getsockopt);
@@ -4032,7 +4031,6 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ return READ_ONCE (sk->sk_prot)->setsockopt (sk, level, optname, optval, optlen); }EXPORT_SYMBOL (sock_common_setsockopt);
net/ipv4/af_inet.c +0 -3
@@ -582,7 +582,6 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr_unsized *uaddr,if (addr_len <sizeof (uaddr->sa_family))return -EINVAL ; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);if (uaddr->sa_family ==AF_UNSPEC )
@@ -789,7 +788,6 @@ int inet_accept(struct socket *sock, struct socket *newsock, {struct sock *sk1 = sock->sk, *sk2; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ arg->err = -EINVAL ; sk2 =READ_ONCE (sk1->sk_prot)->accept (sk1, arg);if (!sk2)
@@ -875,7 +873,6 @@ void inet_splice_eof(struct socket *sock)if (unlikely (inet_send_prepare (sk)))return ; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);if (prot->splice_eof) prot->splice_eof (sock);
net/ipv6/af_inet6.c +0 -4
@@ -429,7 +429,6 @@ int inet6_bind_sk(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len)const struct proto *prot;int err =0 ; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);/* If the socket has its own bind function then use it. */ if (prot->bind)
@@ -567,7 +566,6 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)case SIOCSIFDSTADDR :return addrconf_set_dstaddr (net, argp);default : -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);if (!prot->ioctl)return -ENOIOCTLCMD ;
@@ -636,7 +634,6 @@ int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)if (unlikely (inet_send_prepare (sk)))return -EAGAIN ; -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);return INDIRECT_CALL_2 (prot->sendmsg, tcp_sendmsg, udpv6_sendmsg, sk, msg, size);
@@ -651,7 +648,6 @@ int inet6_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,if (likely (!(flags &MSG_ERRQUEUE )))sock_rps_record_flow (sk); -/* IPV6_ADDRFORM can change sk->sk_prot under us. */ prot =READ_ONCE (sk->sk_prot);return INDIRECT_CALL_2 (prot->recvmsg, tcp_recvmsg, udpv6_recvmsg, sk, msg, size, flags);
net/ipv6/ipv6_sockglue.c +0 -87
100 lines not on this page · raw message
Signature · 1 line
2.55.0.1003.g10538fe699-goog
Re: [PATCH v1 net-next 2/2] ipv6: Remove IPV6_ADDRFORM.
Quoted 7 lines · Kuniyuki Iwashima
Recently,
IPV6_ADDRFORMhas received many AI-driven bug reports. Fixing them properly would needlessly churn the fast paths in TCP and UDP.
IPV6_ADDRFORMwas initially introduced in RFC 2133 in 1997, but only two years later, it was removed from RFC 2553 in 1999.
Quoted 6 lines
In 2026, modern applications natively support dual-stack sockets; notably, systemd's socket activation does not use
IPV6_ADDRFORM.Also,
getsockopt(IPV6_ADDRFORM)can be replaced withSO_DOMAIN.Let's remove
IPV6_ADDRFORM.
Yes please!
Quoted 2 lines
Later, we can remove
sk->sk_prot_creatorand revert commitc26c192c3d48("udp: properly deal with xfrm encap and ADDRFORM").
I'm not 110% sure syzkaller or others will find a way to still trigger the race addressed there, but I guess we will see.
Also I guess we can get rid of several READ_ONCE(sk->sk_family).
/P
Re: [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
In reply to Kuniyuki IwashimaQuoted 41 lines · Kuniyuki Iwashima
The following state transitions have long been a playground for syzbot, and recently AI joined in, reporting a lot more bugs.
*
listen()+shutdown()+connect()
*connect()+connect(AF_UNSPEC)+listen()All the fix attempts would add more code to the fast path, which is not worth it.
Instead of playing whack-a-mole with these edge-case bugs, let's disallow these transitions.
Note that
unhashed_stateis placed in the 4-byte hole aftericsk_pmtu_cookie.$ pahole -C inet_connection_sock vmlinux struct inet_connection_sock { ... __u32 icsk_pmtu_cookie; /* 1208 4 */ unsigned char unhashed_state; /* 1212 1 *//* XXX 3 bytes hole, try to pack */Reported-by Kyle Zeng <[email protected]>Reported-by Michal Luczaj <[email protected]>Reported-by Hyunwoo Kim <[email protected]>Signed-off-by Kuniyuki Iwashima <[email protected]>--- include/net/inet_connection_sock.h | 1 + net/ipv4/inet_connection_sock.c | 1 + net/ipv4/inet_hashtables.c | 11 +++++++++++ 3 files changed, 13 insertions(+)include/net/inet_connection_sock.h +0
-0
include/net/inet_connection_sock.h struct inet_connection_sock { · line 100
Quoted 7 lines
include/net/inet_connection_sock.h +1
-0@@ -94,6 +94,7 @@ struct inet_connection_sock {u32 icsk_rto_max;__u32 icsk_delack_max;__u32 icsk_pmtu_cookie; +unsigned char unhashed_state;const struct tcp_congestion_ops *icsk_ca_ops;const struct inet_connection_sock_af_ops *icsk_af_ops;const struct tcp_ulp_ops *icsk_ulp_ops;
Glad we went in that direction in the end. Makes like easier.
Nit: Could be a flag, like CAN_LISTEN or CAN_CONNECT? Either INET_FLAGS_* or maybe we need ICSK_FLAGS_*?
[email protected]
AI reviewRe: [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
In reply to Kuniyuki IwashimaThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Critical: 0 · High: 0 · Medium: 0 · Low: 1
- [Low] The commit carries three Reported-by/Closes pairs for concrete, user-triggerable bug reports (including a sockmap/TCP leak) but no…
--
tcp: Do not allow buggy transitions between ehash and lhash2.
This adds a new unhashed_state field to struct inet_connection_sock, recording sk->sk_state at inet_unhash() time, and uses it to reject listen() on a socket that was unhashed from a non-listening state and connect() on a socket that was unhashed as a listener.
[Severity: Low]
The changelog carries three Reported-by/Closes pairs for concrete, user-triggerable reports (including the sockmap/TCP socket leak), but there is no Fixes: tag and no note about stable trees.
Since the same change also tightens observable behaviour in inet_hash() and __inet_hash_connect() (listen() and connect() now return -EINVAL for sequences that previously succeeded), would it help backporters to either add a Fixes: tag, or state in the changelog why no tag is given?
Without either, stable maintainers have no anchor commit and no record of the trade-off between closing the reported memory-safety issues and the new -EINVAL returns from listen()/connect().
Quoted 16 lines
net/ipv4/inet_hashtables.c +5
-0@@ -803,6 +803,11 @@ int inet_hash(struct sock *sk)inet_init_ehash_secret ();WARN_ON (!sk_unhashed (sk)); + +if (unlikely (inet_csk (sk)->unhashed_state && +inet_csk (sk)->unhashed_state !=TCP_LISTEN )) +return -EINVAL ; + ilb2 =inet_lhash2_bucket_sk (hashinfo, sk);spin_lock (&ilb2->lock);
[ ... ]
Quoted 10 lines
net/ipv4/inet_hashtables.c +3
-0@@ -1058,6 +1066,9 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,int ret, i, low, high;bool local_ports; +if (unlikely (inet_csk (sk)->unhashed_state ==TCP_LISTEN )) +return -EINVAL ; +if (port) {local_bh_disable (); ret = check_established(death_row, sk, port, NULL, false,
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260904033543.2635540-1-kuniyu%40google.com
[email protected]
AI reviewRe: [PATCH v1 net-next 2/2] ipv6: Remove IPV6_ADDRFORM.
In reply to Kuniyuki IwashimaThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Critical: 0 · High: 1 · Medium: 0 · Low: 2
- [High] Verified userspace-visible ABI removal with no deprecation path and no disclosure of the resulting errno.
- [Low] The removal is incomplete: the patch cleans up the ADDRFORM comments in net/core/sock.c, net/ipv4/af_inet.c and…
- [Low] security/landlock/net.c retains three comments (and one user- visible policy decision) whose entire justification is that 'sk_family…
--
ipv6: Remove IPV6_ADDRFORM.
This removes the IPV6_ADDRFORM socket option from both the setsockopt and getsockopt paths in net/ipv6/ipv6_sockglue.c, and drops the comments in net/core/sock.c, net/ipv4/af_inet.c, net/ipv6/af_inet6.c and include/linux/net.h that documented the sk_prot, sk_family and socket->ops mutability the option caused. The commit message notes that sk->sk_prot_creator and commit c26c192c3d48 can be cleaned up afterwards.
include/linux/net.h struct socket { · line 172
Quoted 13 lines
include/linux/net.h +1
-1@@ -166,7 +166,7 @@ struct socket {struct file *file;struct sock *sk; -const struct proto_ops *ops;/* Might change with IPV6_ADDRFORM or MPTCP. */ +const struct proto_ops *ops;/* Might change with MPTCP. */ struct socket_wq wq; };
[Severity: Low]
This hunk and the ones in net/core/sock.c, net/ipv4/af_inet.c and net/ipv6/af_inet6.c clean up the ADDRFORM comments, but a grep at this commit still finds three places whose only justification was the option.
The kernel-doc for the retained sk_prot_creator field in include/net/sock.h still points at the deleted code:
* @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt,
* IPV6_ADDRFORM for instance)
set_xfrm_gro_udp_encap_rcv() in net/ipv4/udp.c still explains its unregister branch with a feature that no longer exists:
if (udp_sk(sk)->gro_receive != new_gro_receive) {
/*
* With IPV6_ADDRFORM the gro callback could change
* after being set, unregister the old one, if valid.
*/The family argument there comes from sk->sk_family, which can no longer change for a live socket, so is the remaining comment accurate?
mptcp_supported_sockopt() in net/mptcp/sockopt.c still lists the option among the IPv6 options MPTCP does not support:
/* IPV6_MULTICAST_HOPS, IPV6_MULTICAST_LOOP, IPV6_UNICAST_IF, * IPV6_MULTICAST_IF, IPV6_ADDRFORM,
Were these three left out on purpose? Only the udp.c one is mentioned in the commit message, as a later revert of c26c192c3d48, so it is hard to tell which leftovers are intentional.
net/core/sock.c bool sk_mc_loop(const struct sock *sk) · line 776
Quoted 13 lines
net/core/sock.c +1
-1@@ -770,7 +770,7 @@ bool sk_mc_loop(const struct sock *sk)return false;if (!sk)return true; -/* IPV6_ADDRFORM can change sk->sk_family under us. */ +switch (READ_ONCE (sk->sk_family)) {case AF_INET :return inet_test_bit (MC_LOOP , sk);
[Severity: Low]
Dropping this comment in sk_mc_loop() says the tree now treats sk_family as stable after socket creation, and a grep for writes to sk->sk_family agrees:
the only assignments left are in sk_alloc(), the per-family create paths such as inet6_create(), and net/bpf/test_run.c on a freshly allocated socket.
security/landlock/net.c was not updated the same way, so the tree now holds two contradictory statements about the same field. current_check_access_socket() still says:
/* * The socket is not locked, so sk_family can change concurrently due to * e.g. setsockopt(IPV6_ADDRFORM). */ sock_family = READ_ONCE(sock->sk->sk_family);
and, further down, it still denies an explicit AF_UNSPEC destination on an IPv6 UDP socket for that same reason, while conceding the operation should be permitted:
* on such sockets (so it should always be
* allowed). That's because the socket's family
* can change under our feet (if another thread
* calls setsockopt(IPV6_ADDRFORM)) to IPv4,
* which would then treat AF_UNSPEC as AF_INET. */
audit_net.family = AF_UNSPEC;
The bind path repeats the same rationale. Should the Landlock comments be updated in this series too, or at least called out in the commit message so whoever revisits that -EACCES knows the premise is gone?
Quoted 23 lines
net/ipv6/ipv6_sockglue.c +0
-14@@ -547,86 +547,7 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,sockopt_lock_sock (sk); -/* Another thread has converted the socket into IPv4 with -* IPV6_ADDRFORM concurrently. -*/ -if (unlikely (sk->sk_family !=AF_INET6 )) - goto unlock; -switch (optname) { - -case IPV6_ADDRFORM : -if (optlen <sizeof (int )) - goto e_inval; -if (val ==PF_INET ) { -if (sk->sk_type ==SOCK_RAW ) -break ; -
[ ... ]
Quoted 22 lines
net/ipv6/ipv6_sockglue.c +0
-15-/* Disable all options not to allocate memory anymore, -* but there is still a race. See the lockless path -* in udpv6_sendmsg() and ipv6_local_rxpmtu(). -*/ - np->rxopt.all =0 ; - -inet6_cleanup_sock (sk); - -module_put (THIS_MODULE ); - retv =0 ; -break ; - } - goto e_inval; -case IPV6_V6ONLY :if (optlen <sizeof (int ) ||inet_sk (sk)->inet_num)@@ -1088,14 +1009,6 @@ int do_ipv6_getsockopt(struct sock *sk, int level, int optname,if (copy_from_sockptr (&len, optlen,sizeof (int )))return -EFAULT ;switch (optname) { -case IPV6_ADDRFORM :
net/ipv6/ipv6_sockglue.c int do_ipv6_getsockopt(struct sock *sk, int level, int optname, · line 1014
Quoted 10 lines
net/ipv6/ipv6_sockglue.c +0
-7-if (sk->sk_protocol !=IPPROTO_UDP && - sk->sk_protocol !=IPPROTO_TCP ) -return -ENOPROTOOPT ; -if (sk->sk_state !=TCP_ESTABLISHED ) -return -ENOTCONN ; - val = sk->sk_family; -break ;case MCAST_MSFILTER :if (in_compat_syscall ())return compat_ipv6_get_msfilter (sk, optval, optlen, len);
[Severity: High]
Is this a user visible ABI regression that needs a deprecation step first?
With the case gone from do_ipv6_setsockopt(), optname 1 matches nothing in either the lockless or the locked switch, so the function falls through to its initial value:
int retv = -ENOPROTOOPT;
ipv6_setsockopt() then hands optname 1 to netfilter:
if (err == -ENOPROTOOPT && optname != IPV6_IPSEC_POLICY && optname != IPV6_XFRM_POLICY) err = nf_setsockopt(sk, PF_INET6, optname, optval, optlen);
No PF_INET6 sockopt handler claims optnames below IP6T_BASE_CTL (64), so setsockopt(SOL_IPV6, IPV6_ADDRFORM, &PF_INET, 4) now returns -ENOPROTOOPT where it previously converted an established v4-mapped socket, and getsockopt(SOL_IPV6, IPV6_ADDRFORM) hits the default: return -ENOPROTOOPT; arm of do_ipv6_getsockopt() where it previously returned sk->sk_family.
The UAPI definition is kept:
#define IPV6_ADDRFORM 1
so existing binaries keep compiling and only start failing at runtime with a generic "Protocol not available", with no pr_warn_once() naming the caller and no Kconfig or sysctl to restore the old behaviour.
Could the commit message state the new errno explicitly, and say that already-built applications will fail at runtime rather than at build time?
The message says "getsockopt(IPV6_ADDRFORM) can be replaced with SO_DOMAIN", which covers only the getsockopt side and still needs a recompile. Is there any suggested replacement for the setsockopt side, i.e. for the IPv6 to IPv4 socket conversion itself?
Would a warn-and-deprecate cycle before the removal make this easier for whoever is still calling it?
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260904033543.2635540-1-kuniyu%40google.com
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 4 Sep 2026 03:35:27 +0000 you wrote:
The following operations have recently received a lot of AI-driven bug reports:
*
listen()+shutdown()+connect()
*connect()+connect(AF_UNSPEC)+listen()*
setsockopt(IPV6_ADDRFORM)[...]
Here is the summary with links:
- [v1,net-next,1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
https://git.kernel.org/netdev/net-next/c/8cc3aef0cb19 - [v1,net-next,2/2] ipv6: Remove IPV6_ADDRFORM. https://git.kernel.org/netdev/net-next/c/31c5ea8a3296
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH v1 net-next 2/2] ipv6: Remove IPV6_ADDRFORM.
In reply to Kuniyuki IwashimaQuoted 7 lines · On Fri, 4 Sep 2026 03:35:29 +0000 Kuniyuki Iwashima <[email protected]> wrote:
Recently,
IPV6_ADDRFORMhas received many AI-driven bug reports. Fixing them properly would needlessly churn the fast paths in TCP and UDP.
IPV6_ADDRFORMwas initially introduced in RFC 2133 in 1997, but only two years later, it was removed from RFC 2553 in 1999.
Quoted 6 lines
In 2026, modern applications natively support dual-stack sockets; notably, systemd's socket activation does not use
IPV6_ADDRFORM.Also,
getsockopt(IPV6_ADDRFORM)can be replaced withSO_DOMAIN.Let's remove
IPV6_ADDRFORM.
How does the ipv6(7) man page get updated to match?
...
net/ipv6/ipv6_sockglue.c int do_ipv6_setsockopt(struct sock *sk, int level, int optname, · line 624
Quoted 1 line
net/ipv6/ipv6_sockglue.c +0
-1-module_put (THIS_MODULE );
That wasn't good...
David
Re: [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
In reply to Kuniyuki IwashimaQuoted 5 lines · Kuniyuki Iwashima
The following state transitions have long been a playground for syzbot, and recently AI joined in, reporting a lot more bugs.
*
listen()+shutdown()+connect()
*connect()+connect(AF_UNSPEC)+listen()
Hi there. Thanks for closing these. I'm wondering if connect() -> listen() via timewait is intentionally left open?
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+.01...0.011 connect(3, ..., ...) = 0
+0 > S 0:0(0) <...>
+0 < S. 0:0(0) ack 1 win 32000 <mss 1460,nop,wscale 7> +0 > . 1:1(0) ack 1
+0 shutdown(3, SHUT_WR) = 0
+0 > F. 1:1(0) ack 1
+0 < . 1:1(0) ack 2 win 257
+0 < F. 1:1(0) ack 2 win 257
+0 > . 2:2(0) ack 2
+0 connect(3, AF_UNSPEC, ...) = 0
+0 listen(3, 1) = 0
For PSP, this allows us to end up with a listen socket with PSP state, because we don't clear it out in tcp_disconnect(). I'm planning a series to remove PSP on listen sockets, and closing this would make that a lot easier.
Kuniyuki Iwashima
maintainerRe: [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
Quoted 10 lines · Daniel Zahka
Quoted 5 lines · Kuniyuki Iwashima
The following state transitions have long been a playground for syzbot, and recently AI joined in, reporting a lot more bugs.
*
listen()+shutdown()+connect()
*connect()+connect(AF_UNSPEC)+listen()Hi there. Thanks for closing these. I'm wondering if
connect()->listen()via timewait is intentionally left open?
Ah, good catch. I missed inet_twsk_hashdance_schedule() unhashes wihtout calling inet_unhash().
I'll post this.
net/ipv4/inet_timewait_sock.c +0 -0
index d4c781a0667f..5772a64fcdbe 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -110,6 +110,8 @@ void inet_twsk_hashdance_schedule(struct inet_timewait_sock *tw,
spinlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
struct inet_bind_hashbucket *bhead, *bhead2;
+ inet_csk(sk)->unhashed_state = sk->sk_state;
+
/* Put TW into bind hash. Original socket stays there too.
* Note, that any socket with inet->num != 0 MUST be bound in
* binding cache, even if it is closed.
Thanks !
Quoted 11 lines · Kuniyuki Iwashima
The following operations have recently received a lot of AI-driven bug reports:
*
listen()+shutdown()+connect()
*connect()+connect(AF_UNSPEC)+listen()*
setsockopt(IPV6_ADDRFORM)They are not worth fixing by churning the fast path, so this series disallows the transitions and removes
IPV6_ADDRFORM.
Quoted 7 lines
https://lore.kernel.org/netdev/CANn89i+px52TtJy3S9=uHxGj3s-WueguRo1Z_4FxO=02KLmwmQ@mail.gmail.com/
https://lore.kernel.org/netdev/[email protected]/I did not add Fixes tags, but if we want to backport, the tag would be:
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Hi netdev maintainers,
What is the plan for stable backports here? Does the uapi change rule this series out for stable?
Quoted 6 lines
Kuniyuki Iwashima (2):
tcp: Do not allow buggy transitions between ehash and lhash2.
ipv6: RemoveIPV6_ADDRFORM.
Quoted 13 lines
include/linux/net.h | 2 +- include/net/inet_connection_sock.h | 1 + net/core/sock.c | 4 +- net/ipv4/af_inet.c | 3 -- net/ipv4/inet_connection_sock.c | 1 + net/ipv4/inet_hashtables.c | 11 ++++ net/ipv6/af_inet6.c | 4 -- net/ipv6/ipv6_sockglue.c | 87 ------------------------------ 8 files changed, 15 insertions(+), 98 deletions(-)Signature · 1 line
2.55.0.1003.g10538fe699-goog
Best regards,
Hyunwoo Kim
Jakub Kicinski
maintainerQuoted 6 lines · On Sat, 19 Sep 2026 07:35:05 +0900 Hyunwoo Kim wrote:
Quoted 1 line
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Hi netdev maintainers,
What is the plan for stable backports here? Does the uapi change rule this series out for stable?
Not super well defined to be completely honest.
My gut feeling is that we should wait for it to reach Linus, and ~rc3 then pull it to LTS. Which would mean 2 months from now (mid Nov).
That said, I am personally pretty unbothered about local exploits. There's too many of them. And because of the serious exploits (remote, VM escape etc) I think people are not deploying stable much more rapidly and with less testing. I don't want to inject a de-feature under such condition.
Adding Greg and stable in case they have a stronger stomach.
Also FWIW I believe that Eric D is AFK at the moment, and he's the only netdev maintainer subscribed to security@, AFAIU, so y'all may be aware of more things than I am...
Greg Kroah-Hartman
maintainerQuoted 11 lines · Jakub Kicinski
Quoted 6 lines · On Sat, 19 Sep 2026 07:35:05 +0900 Hyunwoo Kim wrote:
Quoted 1 line
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Hi netdev maintainers,
What is the plan for stable backports here? Does the uapi change rule this series out for stable?
Not super well defined to be completely honest.
My gut feeling is that we should wait for it to reach Linus, and ~rc3 then pull it to LTS. Which would mean 2 months from now (mid Nov).
Once it's in a released -rc, why not have it backported then? Why wait? :)
Quoted 7 lines
That said, I am personally pretty unbothered about local exploits. There's too many of them. And because of the serious exploits (remote, VM escape etc) I think people are not deploying stable much more rapidly and with less testing. I don't want to inject a de-feature under such condition.
Adding Greg and stable in case they have a stronger stomach.
I like to see the stable trees match Linus's whenever possible, especially when we have known bugfixes.
Quoted 3 lines
Also FWIW I believe that Eric D is AFK at the moment, and he's the only netdev maintainer subscribed to security@, AFAIU, so y'all may be aware of more things than I am...
Not any more aware of anything other than the normal flood of crud...
thanks,
greg k-h
Jakub Kicinski
maintainerQuoted 10 lines · On Sun, 20 Sep 2026 09:45:14 +0200 Greg Kroah-Hartman wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 2 lines · On Sat, 19 Sep 2026 07:35:05 +0900 Hyunwoo Kim wrote:
What is the plan for stable backports here? Does the uapi change rule this series out for stable?
Not super well defined to be completely honest.
My gut feeling is that we should wait for it to reach Linus, and ~rc3 then pull it to LTS. Which would mean 2 months from now (mid Nov).Once it's in a released -rc, why not have it backported then? Why wait? :)
To be clear - it's in -next right now.
Quoted 8 lines
Quoted 7 lines
That said, I am personally pretty unbothered about local exploits. There's too many of them. And because of the serious exploits (remote, VM escape etc) I think people are not deploying stable much more rapidly and with less testing. I don't want to inject a de-feature under such condition.
Adding Greg and stable in case they have a stronger stomach.
Quoted 8 lines
I like to see the stable trees match Linus's whenever possible, especially when we have known bugfixes.
Quoted 3 lines
Also FWIW I believe that Eric D is AFK at the moment, and he's the only netdev maintainer subscribed to security@, AFAIU, so y'all may be aware of more things than I am...
Not any more aware of anything other than the normal flood of crud...
Okay then, I think we should just wait for the merge window, and reevaluate if^w as new bugs show up.
Hyunwoo, if you have bugs in the queue that are solved in -next I'd hold off on sending the fixes unless they can be triggered remotely or from a VM.
Quoted 29 lines · Jakub Kicinski
Quoted 10 lines · On Sun, 20 Sep 2026 09:45:14 +0200 Greg Kroah-Hartman wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 2 lines · On Sat, 19 Sep 2026 07:35:05 +0900 Hyunwoo Kim wrote:
What is the plan for stable backports here? Does the uapi change rule this series out for stable?
Not super well defined to be completely honest.
My gut feeling is that we should wait for it to reach Linus, and ~rc3 then pull it to LTS. Which would mean 2 months from now (mid Nov).Once it's in a released -rc, why not have it backported then? Why wait? :)
To be clear - it's in -next right now.
Quoted 15 lines
Quoted 7 lines
That said, I am personally pretty unbothered about local exploits. There's too many of them. And because of the serious exploits (remote, VM escape etc) I think people are not deploying stable much more rapidly and with less testing. I don't want to inject a de-feature under such condition.
Adding Greg and stable in case they have a stronger stomach.
I like to see the stable trees match Linus's whenever possible, especially when we have known bugfixes.
Quoted 3 lines
Also FWIW I believe that Eric D is AFK at the moment, and he's the only netdev maintainer subscribed to security@, AFAIU, so y'all may be aware of more things than I am...
Quoted 8 lines
Quoted 1 line
Not any more aware of anything other than the normal flood of crud...
Okay then, I think we should just wait for the merge window, and reevaluate if^w as new bugs show up.
Hyunwoo, if you have bugs in the queue that are solved in -next I'd hold off on sending the fixes unless they can be triggered remotely or from a VM.
OK, will do.
Best regards,
Hyunwoo Kim