* [PATCH net] ipvs: adjust non-SYNC hashing after late destination binding
@ 2026-12-01 11:00 zhuorao yang
0 siblings, 0 replies; only message in thread
From: zhuorao yang @ 2026-12-01 11:00 UTC (permalink / raw)
To: Simon Horman, Julian Anastasov, Pablo Neira Ayuso,
Florian Westphal, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Willem de Bruijn
Cc: netdev, lvs-devel, netfilter-devel, coreteam
ip_vs_try_bind_dest() can bind a destination to an already hashed
connection without IP_VS_CONN_F_SYNC. The non-SYNC branch of
ip_vs_bind_dest() changes the forwarding method directly instead of
calling ip_vs_conn_change_fwd_mask().
A change between MASQ and non-MASQ changes whether hn1 is linked.
The resulting stale or missing hash node can be accessed by connection
lookup, resizing, or expiration after ip_vs_conn has been freed.
Move the hashed-connection update outside the SYNC-only branch so both
late-binding paths use the existing helper.
Fixes: f20c73b0460d ("ipvs: use more keys for connection hashing")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---
Vulnerability report
Affected versions: Linux 7.4-rc5 and 7.4-rc4; vulnerable generations are
kernels with IPVS double hashing introduced by f20c73b0460d
(v7.1-rc1).
Trigger conditions: IPVS backup synchronization must be enabled,
ip_vs_ftp must be loaded, and a TCP:21 service must have a DR/TUN real
server. An unauthenticated sync datagram and FTP PASV flow can create
and then late-bind a hashed non-SYNC connection with dest == NULL.
Configuring IPVS and the service requires CAP_NET_ADMIN; injecting the
remote sync datagram itself does not. Related work: 712d2993bea5 added
ip_vs_conn_change_fwd_mask() for the SYNC late-binding branch; this
patch covers the remaining non-SYNC branch.
Reproducer status: Same-version Linux 7.4-rc5 KASAN QEMU: unpatched
kernel produced 15 slab-use-after-free reports (13 reads and 2 writes)
in conn_resize_work_handler/ip_vs_conn_hashkey_conn. With this patch,
bind removed hn1, expiration and forced resize completed without
KASAN, and the kernel powered down normally. The test harness drives
real IPVS connection and destination-binding code; the final network-
only FTP/sync injection chain has not yet been demonstrated end to
end.
Reproducer material is intentionally withheld from this public message.
AI assistance: DeepSeek identified the issue and drafted the patch.
The submitter reviewed the code and certified the Developer Certificate
of Origin.
net/netfilter/ipvs/ip_vs_conn.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 83d8a9153a34..ad3671288b3b 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1134,17 +1134,16 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
/* connections inherit forwarding method from dest */
flags &= ~(IP_VS_CONN_F_FWD_MASK | IP_VS_CONN_F_NOOUTPUT);
flags |= conn_flags;
- /* Changing forwarding method for hashed conn can
- * happen only under locks
- */
- if (cp->flags & IP_VS_CONN_F_HASHED)
- ip_vs_conn_change_fwd_mask(cp, flags);
- else
- cp->flags = flags;
} else {
flags |= conn_flags;
- cp->flags = flags;
}
+ /* Changing forwarding method for hashed conn can
+ * happen only under locks.
+ */
+ if (cp->flags & IP_VS_CONN_F_HASHED)
+ ip_vs_conn_change_fwd_mask(cp, flags);
+ else
+ cp->flags = flags;
cp->dest = dest;
IP_VS_DBG_BUF(7, "Bind-dest %s c:%s:%d v:%s:%d "
--
2.56.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 11:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 11:00 [PATCH net] ipvs: adjust non-SYNC hashing after late destination binding zhuorao yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox