🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Pablo Neira Ayuso Fri, 13 Nov 2026 01:14
[PATCH net 00/15] IPVS fixes for net
#15627
Author: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 01:14
123 lines
13017 bytes
Hi,

The following patchset contains IPVS fixes for net:

1)  Avoid out-of-bounds write in ip_vs_nat_icmp_v6() when an ICMPv6
    error embeds a non-first ESP fragment, from Axel Mierczuk.

2)  Update *offset for non-first fragments in ipv6_find_hdr(), so
    callers no longer use the initial offset as if it had been
    updated. Also from Axel.

3)  Rework connection refcounting so the pending and running timer
    hold a reference. This fixes a use-after-free race between
    connection deletion and a concurrent timer callback, from
    Julian Anastasov.

4)  Expire controlled connection chains iteratively instead of
    recursively to avoid kernel stack exhaustion, from Zihan Xi.

5)  Reject zero and configured FTP control ports as data ports in
    the FTP helper, from Zihan Xi.

6)  Skip conntrack templates in ip_vs_ftp_out() to fix a UAF in the
    expectation list after the CT rule is removed, from Theodor
    Arsenij Larionov Trichkine.

7)  Add the seqadj extension before linking the FTP expectation, since
    krealloc() of ct->ext can otherwise leave the expectation pointing
    to freed memory. Also from Theodor.

8)  Update conn flags, seqs and related fields in the backup server
    under cp->lock, from Julian Anastasov.

9)  Read conn flags and seqs atomically in the master when building
    sync messages, from Julian Anastasov.

10) Fix a race that can leave a destination in the overload state
    forever. Also make the LBLC/LBLCR schedulers honor the overload
    state for cached destinations, from Julian Anastasov.

11) Validate cport and IP_VS_CONN_F_NO_CPORT in received sync records.
    This rejects templates and connections that incoming lookups
    cannot match, from Axel Mierczuk.

12) Skip cport 0 connections in ip_vs_conn_out_get(), using the same
    rule as __ip_vs_conn_in_get(). Also from Axel.

13) Do not create connections from packets with client or virtual
    port 0, which could create a duplicate connection for every
    packet, from Julian Anastasov.

14) Wait for an RCU grace period before reusing a destination from
    dest_trash, and before restarting its estimator, from Darong Lu.

15) Pass the netfilter hook's state->sk to the update_pmtu handler,
    and pass a NULL sk to ip_local_out() when forwarding through an
    IPVS tunnel, from Julian Anastasov.

Please, pull these changes from:

  git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-26-11-13

Thanks.

----------------------------------------------------------------

The following changes since commit d1bb235aa409a4e5aeba6c748d953d948625b1e9:

  netfilter: nat: zero newrange before filling it in (2026-11-05 13:31:11 +0100)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-26-11-13

for you to fetch changes up to 937b060406a547e4d931525e600540726ea26532:

  ipvs: pass correct sk to update_pmtu and on tunneling (2026-11-13 02:08:35 +0100)

----------------------------------------------------------------
netfilter pull request 26-11-13

----------------------------------------------------------------
Axel Mierczuk (4):
      ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
      ipv6: update *offset for non-first fragments in ipv6_find_hdr()
      ipvs: validate cport in received sync records
      ipvs: skip cport 0 connections in ip_vs_conn_out_get()

Darong Lu (1):
      ipvs: wait grace period before reusing destinations

Julian Anastasov (6):
      ipvs: fix problems during connection deletion
      ipvs: update flags and seqs in backup server under lock
      ipvs: read flags and seqs in master atomically
      ipvs: honor the overload state and do not enter it forever
      ipvs: do not create conns from packets with port 0
      ipvs: pass correct sk to update_pmtu and on tunneling

Theodor Arsenij Larionov Trichkine (2):
      ipvs: ftp: skip conntrack templates in ip_vs_ftp_out
      ipvs: ftp: add seqadj extension before linking the expectation

Zihan Xi (2):
      ipvs: avoid stack overflow from recursive connection expiration
      ipvs: reject FTP control ports as data ports

 include/net/ip_vs.h                     |  52 ++++++++----
 net/ipv6/exthdrs_core.c                 |   6 +-
 net/netfilter/ipvs/ip_vs_conn.c         | 133 ++++++++++++++++++------------
 net/netfilter/ipvs/ip_vs_core.c         |  58 +++++++++----
 net/netfilter/ipvs/ip_vs_ctl.c          | 140 ++++++++++++++++++++++++--------
 net/netfilter/ipvs/ip_vs_ftp.c          |  39 +++++++--
 net/netfilter/ipvs/ip_vs_lblc.c         |   8 +-
 net/netfilter/ipvs/ip_vs_lblcr.c        |  13 +--
 net/netfilter/ipvs/ip_vs_proto_ah_esp.c |   2 +-
 net/netfilter/ipvs/ip_vs_proto_sctp.c   |  12 ++-
 net/netfilter/ipvs/ip_vs_proto_tcp.c    |  12 ++-
 net/netfilter/ipvs/ip_vs_proto_udp.c    |  11 ++-
 net/netfilter/ipvs/ip_vs_sync.c         |  53 ++++++++++--
 net/netfilter/ipvs/ip_vs_xmit.c         | 114 +++++++++++++++++---------
 14 files changed, 462 insertions(+), 191 deletions(-)
[PATCH net 09/15] ipvs: read flags and seqs in master atomically
#15635
Author: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 01:14
91 lines
11654 bytes
From: Julian Anastasov <ja@ssi.bg>

After we fixed the double read of cp->flags in the master with
commit 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Sashiko reports that we should also read the cp->flags and the seqs
atomically. So if the SEQ_MASK is set, re-read the flags and the
seqs under cp->lock to provide a snapshot when sending the sync
message.

Fixes: 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260927220816.268206-1-pablo%40netfilter.org
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipvs/ip_vs_sync.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index ba2fa1f9d08e..f11c59eca553 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -539,6 +539,7 @@ static int ip_vs_sync_conn_needed(struct netns_ipvs *ipvs,
 static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
 			       int pkts)
 {
+	struct ip_vs_sync_conn_options opts;
 	struct ip_vs_sync_mesg_v0 *m;
 	struct ip_vs_sync_conn_v0 *s;
 	struct ip_vs_sync_buff *buff;
@@ -557,6 +558,14 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
 	if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
 		return;
 
+	if (flags & IP_VS_CONN_F_SEQ_MASK) {
+		/* Take atomic snapshot of flags and seqs */
+		spin_lock_bh(&cp->lock);
+		flags = cp->flags;
+		memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+		spin_unlock_bh(&cp->lock);
+	}
+
 	spin_lock_bh(&ipvs->sync_buff_lock);
 	if (!(ipvs->sync_state & IP_VS_STATE_MASTER)) {
 		spin_unlock_bh(&ipvs->sync_buff_lock);
@@ -604,7 +613,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
 	if (seq_mask) {
 		struct ip_vs_sync_conn_options *opt =
 			(struct ip_vs_sync_conn_options *)&s[1];
-		memcpy(opt, &cp->sync_conn_opt, sizeof(*opt));
+		memcpy(opt, &opts, sizeof(*opt));
 	}
 
 	m->nr_conns++;
@@ -630,6 +639,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
  */
 void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
 {
+	struct ip_vs_sync_conn_options opts;
 	struct ip_vs_sync_mesg *m;
 	union ip_vs_sync_conn *s;
 	struct ip_vs_sync_buff *buff;
@@ -651,6 +661,13 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
 	if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
 		goto control;
 	flags = READ_ONCE(cp->flags);
+	if (flags & IP_VS_CONN_F_SEQ_MASK) {
+		/* Take atomic snapshot of flags and seqs */
+		spin_lock_bh(&cp->lock);
+		flags = cp->flags;
+		memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+		spin_unlock_bh(&cp->lock);
+	}
 
 	/* Sanity checks */
 	pe_name_len = 0;
@@ -752,9 +769,9 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
 	if (seq_mask) {
 		*(p++) = IPVS_OPT_SEQ_DATA;
 		*(p++) = sizeof(struct ip_vs_sync_conn_options);
-		hton_seq(&cp->in_seq, (struct ip_vs_seq *)p);
+		hton_seq(&opts.in_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
-		hton_seq(&cp->out_seq, (struct ip_vs_seq *)p);
+		hton_seq(&opts.out_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
 	}
 	/* Handle pe data */
-- 
2.47.3
Re: [PATCH net 00/15] IPVS fixes for net
#16029
Author: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 22:34
132 lines
13669 bytes
Hi,

I'm preparing a v2 of this batch with IPVS fixes, we have identified a
few issues in this batch. I plan to submit it by tomorrow.

Apologies and thanks.

On Fri, Nov 13, 2026 at 02:14:32AM +0100, Pablo Neira Ayuso wrote:
> Hi,
> 
> The following patchset contains IPVS fixes for net:
> 
> 1)  Avoid out-of-bounds write in ip_vs_nat_icmp_v6() when an ICMPv6
>     error embeds a non-first ESP fragment, from Axel Mierczuk.
> 
> 2)  Update *offset for non-first fragments in ipv6_find_hdr(), so
>     callers no longer use the initial offset as if it had been
>     updated. Also from Axel.
> 
> 3)  Rework connection refcounting so the pending and running timer
>     hold a reference. This fixes a use-after-free race between
>     connection deletion and a concurrent timer callback, from
>     Julian Anastasov.
> 
> 4)  Expire controlled connection chains iteratively instead of
>     recursively to avoid kernel stack exhaustion, from Zihan Xi.
> 
> 5)  Reject zero and configured FTP control ports as data ports in
>     the FTP helper, from Zihan Xi.
> 
> 6)  Skip conntrack templates in ip_vs_ftp_out() to fix a UAF in the
>     expectation list after the CT rule is removed, from Theodor
>     Arsenij Larionov Trichkine.
> 
> 7)  Add the seqadj extension before linking the FTP expectation, since
>     krealloc() of ct->ext can otherwise leave the expectation pointing
>     to freed memory. Also from Theodor.
> 
> 8)  Update conn flags, seqs and related fields in the backup server
>     under cp->lock, from Julian Anastasov.
> 
> 9)  Read conn flags and seqs atomically in the master when building
>     sync messages, from Julian Anastasov.
> 
> 10) Fix a race that can leave a destination in the overload state
>     forever. Also make the LBLC/LBLCR schedulers honor the overload
>     state for cached destinations, from Julian Anastasov.
> 
> 11) Validate cport and IP_VS_CONN_F_NO_CPORT in received sync records.
>     This rejects templates and connections that incoming lookups
>     cannot match, from Axel Mierczuk.
> 
> 12) Skip cport 0 connections in ip_vs_conn_out_get(), using the same
>     rule as __ip_vs_conn_in_get(). Also from Axel.
> 
> 13) Do not create connections from packets with client or virtual
>     port 0, which could create a duplicate connection for every
>     packet, from Julian Anastasov.
> 
> 14) Wait for an RCU grace period before reusing a destination from
>     dest_trash, and before restarting its estimator, from Darong Lu.
> 
> 15) Pass the netfilter hook's state->sk to the update_pmtu handler,
>     and pass a NULL sk to ip_local_out() when forwarding through an
>     IPVS tunnel, from Julian Anastasov.
> 
> Please, pull these changes from:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-26-11-13
> 
> Thanks.
> 
> ----------------------------------------------------------------
> 
> The following changes since commit d1bb235aa409a4e5aeba6c748d953d948625b1e9:
> 
>   netfilter: nat: zero newrange before filling it in (2026-11-05 13:31:11 +0100)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-26-11-13
> 
> for you to fetch changes up to 937b060406a547e4d931525e600540726ea26532:
> 
>   ipvs: pass correct sk to update_pmtu and on tunneling (2026-11-13 02:08:35 +0100)
> 
> ----------------------------------------------------------------
> netfilter pull request 26-11-13
> 
> ----------------------------------------------------------------
> Axel Mierczuk (4):
>       ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
>       ipv6: update *offset for non-first fragments in ipv6_find_hdr()
>       ipvs: validate cport in received sync records
>       ipvs: skip cport 0 connections in ip_vs_conn_out_get()
> 
> Darong Lu (1):
>       ipvs: wait grace period before reusing destinations
> 
> Julian Anastasov (6):
>       ipvs: fix problems during connection deletion
>       ipvs: update flags and seqs in backup server under lock
>       ipvs: read flags and seqs in master atomically
>       ipvs: honor the overload state and do not enter it forever
>       ipvs: do not create conns from packets with port 0
>       ipvs: pass correct sk to update_pmtu and on tunneling
> 
> Theodor Arsenij Larionov Trichkine (2):
>       ipvs: ftp: skip conntrack templates in ip_vs_ftp_out
>       ipvs: ftp: add seqadj extension before linking the expectation
> 
> Zihan Xi (2):
>       ipvs: avoid stack overflow from recursive connection expiration
>       ipvs: reject FTP control ports as data ports
> 
>  include/net/ip_vs.h                     |  52 ++++++++----
>  net/ipv6/exthdrs_core.c                 |   6 +-
>  net/netfilter/ipvs/ip_vs_conn.c         | 133 ++++++++++++++++++------------
>  net/netfilter/ipvs/ip_vs_core.c         |  58 +++++++++----
>  net/netfilter/ipvs/ip_vs_ctl.c          | 140 ++++++++++++++++++++++++--------
>  net/netfilter/ipvs/ip_vs_ftp.c          |  39 +++++++--
>  net/netfilter/ipvs/ip_vs_lblc.c         |   8 +-
>  net/netfilter/ipvs/ip_vs_lblcr.c        |  13 +--
>  net/netfilter/ipvs/ip_vs_proto_ah_esp.c |   2 +-
>  net/netfilter/ipvs/ip_vs_proto_sctp.c   |  12 ++-
>  net/netfilter/ipvs/ip_vs_proto_tcp.c    |  12 ++-
>  net/netfilter/ipvs/ip_vs_proto_udp.c    |  11 ++-
>  net/netfilter/ipvs/ip_vs_sync.c         |  53 ++++++++++--
>  net/netfilter/ipvs/ip_vs_xmit.c         | 114 +++++++++++++++++---------
>  14 files changed, 462 insertions(+), 191 deletions(-)
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads