From: zhuorao yang <alex000young@gmail.com>
To: Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>
Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: [PATCH net] ipvs: adjust non-SYNC hashing after late destination binding
Date: Tue, 1 Dec 2026 19:00:12 +0800 [thread overview]
Message-ID: <20261201110012.77694-1-alex000young@gmail.com> (raw)
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
reply other threads:[~2026-12-01 11:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201110012.77694-1-alex000young@gmail.com \
--to=alex000young@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox