OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes
@ 2026-11-30 18:45 Eva Kurchatova
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

Patchset for task https://virtuozzo.atlassian.net/jira/browse/VSTOR-157577

Alice Mikityanska (1):
  ms/net/ipv6: Introduce payload_len helpers

Eric Dumazet (1):
  ms/tcp: purge Fast Open RST queue when listen() fails

Hyunwoo Kim (1):
  ms/tcp: fix NULL pointer dereference when restarting a Fast Open
    listener

Jiayuan Chen (1):
  ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF
    context

Joas Antonio dos Santos (3):
  ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()
  ms/calipso: hash the cache key, not the option start, in
    calipso_cache_add()
  ms/calipso: update payload_len when removing the CALIPSO option

Sechang Lim (1):
  ms/tcp: clear sock_ops cb flags before force-closing a child socket

 include/linux/ipv6.h                       | 22 ++++++++++
 include/net/inet_connection_sock.h         |  8 +---
 include/net/ipv6.h                         |  2 -
 include/net/netfilter/nf_tables_ipv6.h     |  4 +-
 include/net/tcp.h                          |  9 ++++
 net/bridge/br_netfilter_ipv6.c             |  2 +-
 net/bridge/netfilter/nf_conntrack_bridge.c |  4 +-
 net/ipv4/inet_connection_sock.c            | 49 +++++++++++++++-------
 net/ipv6/calipso.c                         | 12 ++++--
 net/ipv6/ip6_input.c                       |  2 +-
 net/ipv6/ip6_offload.c                     |  7 ++--
 net/ipv6/output_core.c                     |  7 +---
 net/netfilter/ipvs/ip_vs_xmit.c            |  2 +-
 net/netfilter/nf_conntrack_ovs.c           |  2 +-
 net/netfilter/nf_log_syslog.c              |  2 +-
 net/sched/sch_cake.c                       |  2 +-
 16 files changed, 89 insertions(+), 47 deletions(-)

-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:17   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context Eva Kurchatova
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Sechang Lim <rhkrqnwk98@gmail.com>

[ Upstream commit 990348e5bb457697c2f1f7f7b65154a3334d9d2b ]

A child socket inherits the listener's bpf_sock_ops_cb_flags via
sk_clone_lock(). If its setup fails in tcp_v4_syn_recv_sock() /
tcp_v6_syn_recv_sock(), the child is freed through put_and_exit, where
inet_csk_prepare_forced_close() drops the socket lock and tcp_done() runs
without it.

If BPF_SOCK_OPS_STATE_CB_FLAG was inherited, tcp_done() -> tcp_set_state()
calls tcp_call_bpf(), which expects the lock and trips sock_owned_by_me():

  WARNING: include/net/sock.h:1799 at tcp_set_state+0x433/0x550
  RIP: 0010:tcp_set_state+0x433/0x550 include/net/sock.h:1799
  Call Trace:
   <IRQ>
   tcp_done+0xba/0x250 net/ipv4/tcp.c:5095
   tcp_v4_syn_recv_sock+0x850/0xa50 net/ipv4/tcp_ipv4.c:1787
   tcp_check_req+0xf30/0x1360 net/ipv4/tcp_minisocks.c:926
   tcp_v4_rcv+0x1047/0x1b50 net/ipv4/tcp_ipv4.c:2164
   </IRQ>

The child is freed before it is ever established, so it should run no
sock_ops callback. Clear its cb flags in inet_csk_prepare_for_destroy_sock(),
the common point for the IPv4, IPv6 and chtls forced-close paths and for the
MPTCP ->syn_recv_sock() failure path (dispose_child), which reaches tcp_done()
on a child that was never established too.

Suggested-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Fixes: d44874910a26 ("bpf: Add BPF_SOCK_OPS_STATE_CB")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260611092923.1895982-1-rhkrqnwk98@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>

[ Moved inet_csk_prepare_for_destroy_sock() to inet_connection_sock.c due to header dependency,
  Added a guard arount the call to tcp_clear_sock_ops_cb_flags to avoid
  calling it for DDCP sockets.]

Signed-off-by: Miguel Gazquez (Schneider Electric) <miguel.gazquez@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit fe23d56e9266d58ba5c380f1970118eedeee0b68)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 include/net/inet_connection_sock.h | 8 +-------
 include/net/tcp.h                  | 9 +++++++++
 net/ipv4/inet_connection_sock.c    | 9 +++++++++
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b607c8e72d88..86aa914a2502 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -299,14 +299,8 @@ reqsk_timeout(struct request_sock *req, unsigned long max_timeout)
 	return (unsigned long)min_t(u64, timeout, max_timeout);
 }
 
-static inline void inet_csk_prepare_for_destroy_sock(struct sock *sk)
-{
-	/* The below has to be done to allow calling inet_csk_destroy_sock */
-	sock_set_flag(sk, SOCK_DEAD);
-	this_cpu_inc(*sk->sk_prot->orphan_count);
-}
-
 void inet_csk_destroy_sock(struct sock *sk);
+void inet_csk_prepare_for_destroy_sock(struct sock *sk);
 void inet_csk_prepare_forced_close(struct sock *sk);
 
 /*
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a88c3faf6ed5..e27daa5cf878 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2704,6 +2704,11 @@ static inline int tcp_call_bpf_3arg(struct sock *sk, int op, u32 arg1, u32 arg2,
 	return tcp_call_bpf(sk, op, 3, args);
 }
 
+static inline void tcp_clear_sock_ops_cb_flags(struct sock *sk)
+{
+	tcp_sk(sk)->bpf_sock_ops_cb_flags = 0;
+}
+
 #else
 static inline int tcp_call_bpf(struct sock *sk, int op, u32 nargs, u32 *args)
 {
@@ -2721,6 +2726,10 @@ static inline int tcp_call_bpf_3arg(struct sock *sk, int op, u32 arg1, u32 arg2,
 	return -EPERM;
 }
 
+static inline void tcp_clear_sock_ops_cb_flags(struct sock *sk)
+{
+}
+
 #endif
 
 static inline u32 tcp_timeout_init(struct sock *sk)
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 8af596b3e9e0..936b0435cfc1 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1282,6 +1282,15 @@ void inet_csk_destroy_sock(struct sock *sk)
 }
 EXPORT_SYMBOL(inet_csk_destroy_sock);
 
+void inet_csk_prepare_for_destroy_sock(struct sock *sk)
+{
+	/* The below has to be done to allow calling inet_csk_destroy_sock */
+	if (sk->sk_protocol == IPPROTO_TCP)
+		tcp_clear_sock_ops_cb_flags(sk);
+	sock_set_flag(sk, SOCK_DEAD);
+	this_cpu_inc(*sk->sk_prot->orphan_count);
+}
+
 /* This function allows to force a closure of a socket after the call to
  * tcp/dccp_create_openreq_child().
  */
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:18   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers Eva Kurchatova
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Jiayuan Chen <jiayuan.chen@linux.dev>

[ Upstream commit eaab8cab451b9502ce224cd202550375b894a467 ]

bpf_sock_destroy() runs from the tcp iterator, under rcu_read_lock(). If
the sock is a listener that still has children in its accept queue,
tcp_abort() ends up in inet_csk_listen_stop() and the cond_resched()
there trips the debug check:

BUG: sleeping function called from invalid context at net/ipv4/inet_connection_sock.c:1523
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 628, name: test_progs
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
locks held by test_progs/628: 3, last CPU#3:
 #0: ffff8881158cee18 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x56/0x1210
 #1: ffff8881106bb858 (sk_lock-AF_INET6){+.+.}-{0:0}, at: bpf_iter_tcp_seq_show+0x32b/0x4b0
 #2: ffffffffb435af20 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x46b/0xde0
CPU: 3 UID: 0 PID: 628 Comm: test_progs Tainted: G        W           7.2.0+ #65 PREEMPT
Tainted: [W]=WARN
Call Trace:
 <TASK>
 dump_stack_lvl+0xc1/0xf0
 dump_stack+0x10/0x20
 __might_resched+0x3d2/0x610
 inet_csk_listen_stop+0x7b/0xbf0
 tcp_abort+0x23b/0x3b0
 bpf_sock_destroy+0xfc/0x140
 bpf_prog_448133d24601754f_iter_tcp6_server+0x81/0x8a
 bpf_iter_run_prog+0x538/0xde0
 bpf_iter_tcp_seq_show+0x26b/0x4b0
 bpf_seq_read+0x424/0x1210
 vfs_read+0x197/0xe40
 ksys_read+0x119/0x240
 __x64_sys_read+0x72/0xc0
 x64_sys_call+0x647/0x27e0
 do_syscall_64+0xe5/0x610
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fad39b28aca
RSP: 002b:00007ffc381c61c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007ffc381c6a88 RCX: 00007fad39b28aca
RDX: 0000000000000032 RSI: 00007ffc381c6250 RDI: 0000000000000014
RBP: 00007ffc381c61e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 0000000000000000 R14: 000055f077c1bbb0 R15: 00007fad3a0f3000
 </TASK>

The commit that added the kfunc already guards lock_sock() in tcp_abort()
and udp_abort() with has_current_bpf_ctx(), but missed the listener path.
Do the same for the cond_resched(). The loop runs inside the iterator's
rcu_read_lock(), it must not reschedule or report a quiescent state there.

Fixes: 4ddbcb886268 ("bpf: Add bpf_sock_destroy kfunc")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://lore.kernel.org/r/20260910112736.153710-1-jiayuan.chen@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 5b52417c6196e05618a3b5d9753dbed9adef0166)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv4/inet_connection_sock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 936b0435cfc1..156467ab4384 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1508,7 +1508,8 @@ void inet_csk_listen_stop(struct sock *sk)
 		local_bh_enable();
 		sock_put(child);
 
-		cond_resched();
+		if (!has_current_bpf_ctx())
+			cond_resched();
 	}
 	if (queue->fastopenq.rskq_rst_head) {
 		/* Free all the reqs queued in rskq_rst_head. */
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:21   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr() Eva Kurchatova
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Alice Mikityanska <alice@isovalent.com>

[ Upstream commit b2936b4fd56294e49d6c8e9152ea6c4982757c7d ]

The next commits will transition away from using the hop-by-hop
extension header to encode packet length for BIG TCP. Add wrappers
around ip6->payload_len that return the actual value if it's non-zero,
and calculate it from skb->len if payload_len is set to zero (and a
symmetrical setter).

The new helpers are used wherever the surrounding code supports the
hop-by-hop jumbo header for BIG TCP IPv6, or the corresponding IPv4 code
uses skb_ip_totlen (e.g., in include/net/netfilter/nf_tables_ipv6.h).

No behavioral change in this commit.

Signed-off-by: Alice Mikityanska <alice@isovalent.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260205133925.526371-2-alice.kernel@fastmail.im
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 8070ed578b6b ("calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7100c4a728911396569eb43e5ce14d557bdbcb08)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 include/linux/ipv6.h                       | 22 ++++++++++++++++++++++
 include/net/ipv6.h                         |  2 --
 include/net/netfilter/nf_tables_ipv6.h     |  4 ++--
 net/bridge/br_netfilter_ipv6.c             |  2 +-
 net/bridge/netfilter/nf_conntrack_bridge.c |  4 ++--
 net/ipv6/ip6_input.c                       |  2 +-
 net/ipv6/ip6_offload.c                     |  7 +++----
 net/ipv6/output_core.c                     |  7 +------
 net/netfilter/ipvs/ip_vs_xmit.c            |  2 +-
 net/netfilter/nf_conntrack_ovs.c           |  2 +-
 net/netfilter/nf_log_syslog.c              |  2 +-
 net/sched/sch_cake.c                       |  2 +-
 12 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a6e2aadbb91b..d960b887469d 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -125,6 +125,28 @@ static inline unsigned int ipv6_transport_len(const struct sk_buff *skb)
 	       skb_network_header_len(skb);
 }
 
+static inline unsigned int
+ipv6_payload_len(const struct sk_buff *skb, const struct ipv6hdr *ip6)
+{
+	u32 len = ntohs(ip6->payload_len);
+
+	return (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?
+		len :
+		skb->len - skb_network_offset(skb) - sizeof(struct ipv6hdr);
+}
+
+static inline unsigned int skb_ipv6_payload_len(const struct sk_buff *skb)
+{
+	return ipv6_payload_len(skb, ipv6_hdr(skb));
+}
+
+#define IPV6_MAXPLEN		65535
+
+static inline void ipv6_set_payload_len(struct ipv6hdr *ip6, unsigned int len)
+{
+	ip6->payload_len = len <= IPV6_MAXPLEN ? htons(len) : 0;
+}
+
 /* 
    This structure contains results of exthdrs parsing
    as offsets from skb->nh.
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 248bfb26e2af..5d25cc46fb28 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -25,8 +25,6 @@ struct ip_tunnel_info;
 
 #define SIN6_LEN_RFC2133	24
 
-#define IPV6_MAXPLEN		65535
-
 /*
  *	NextHeader field of IPv6 header
  */
diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
index a0633eeaec97..c53ac00bb974 100644
--- a/include/net/netfilter/nf_tables_ipv6.h
+++ b/include/net/netfilter/nf_tables_ipv6.h
@@ -42,7 +42,7 @@ static inline int __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt)
 	if (ip6h->version != 6)
 		return -1;
 
-	pkt_len = ntohs(ip6h->payload_len);
+	pkt_len = ipv6_payload_len(pkt->skb, ip6h);
 	skb_len = pkt->skb->len - skb_network_offset(pkt->skb);
 	if (pkt_len + sizeof(*ip6h) > skb_len)
 		return -1;
@@ -86,7 +86,7 @@ static inline int nft_set_pktinfo_ipv6_ingress(struct nft_pktinfo *pkt)
 	if (ip6h->version != 6)
 		goto inhdr_error;
 
-	pkt_len = ntohs(ip6h->payload_len);
+	pkt_len = ipv6_payload_len(pkt->skb, ip6h);
 	if (pkt_len + sizeof(*ip6h) > pkt->skb->len) {
 		idev = __in6_dev_get(nft_in(pkt));
 		__IP6_INC_STATS(nft_net(pkt), idev, IPSTATS_MIB_INTRUNCATEDPKTS);
diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
index e0421eaa3abc..76ce70b4e7f3 100644
--- a/net/bridge/br_netfilter_ipv6.c
+++ b/net/bridge/br_netfilter_ipv6.c
@@ -58,7 +58,7 @@ int br_validate_ipv6(struct net *net, struct sk_buff *skb)
 	if (hdr->version != 6)
 		goto inhdr_error;
 
-	pkt_len = ntohs(hdr->payload_len);
+	pkt_len = ipv6_payload_len(skb, hdr);
 	if (hdr->nexthdr == NEXTHDR_HOP && nf_ip6_check_hbh_len(skb, &pkt_len))
 		goto drop;
 
diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c
index 10127b7588ef..8ec934e5ffd2 100644
--- a/net/bridge/netfilter/nf_conntrack_bridge.c
+++ b/net/bridge/netfilter/nf_conntrack_bridge.c
@@ -234,7 +234,7 @@ static int nf_ct_br_ipv6_check(const struct sk_buff *skb)
 	if (hdr->version != 6)
 		return -1;
 
-	len = ntohs(hdr->payload_len) + sizeof(struct ipv6hdr) + nhoff;
+	len = ipv6_payload_len(skb, hdr) + sizeof(struct ipv6hdr) + nhoff;
 	if (skb->len < len)
 		return -1;
 
@@ -274,7 +274,7 @@ static unsigned int nf_ct_bridge_pre(void *priv, struct sk_buff *skb,
 		if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
 			return NF_ACCEPT;
 
-		len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len);
+		len = sizeof(struct ipv6hdr) + skb_ipv6_payload_len(skb);
 		if (pskb_trim_rcsum(skb, len))
 			return NF_ACCEPT;
 
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 0b3b81fd4a58..9c2be98b961a 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -262,7 +262,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
 	skb->transport_header = skb->network_header + sizeof(*hdr);
 	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
 
-	pkt_len = ntohs(hdr->payload_len);
+	pkt_len = ipv6_payload_len(skb, hdr);
 
 	/* pkt_len may be zero if Jumbo payload option is present */
 	if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index fce91183797a..6762ce7909c8 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -372,12 +372,11 @@ INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
 		hop_jumbo->jumbo_payload_len = htonl(payload_len + hoplen);
 
 		iph->nexthdr = NEXTHDR_HOP;
-		iph->payload_len = 0;
-	} else {
-		iph = (struct ipv6hdr *)(skb->data + nhoff);
-		iph->payload_len = htons(payload_len);
 	}
 
+	iph = (struct ipv6hdr *)(skb->data + nhoff);
+	ipv6_set_payload_len(iph, payload_len);
+
 	nhoff += sizeof(*iph) + ipv6_exthdrs_len(iph, &ops);
 	if (WARN_ON(!ops || !ops->callbacks.gro_complete))
 		goto out;
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index 1c9b283a4132..cba1684a3f30 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -125,12 +125,7 @@ EXPORT_SYMBOL(ip6_dst_hoplimit);
 
 int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
-	int len;
-
-	len = skb->len - sizeof(struct ipv6hdr);
-	if (len > IPV6_MAXPLEN)
-		len = 0;
-	ipv6_hdr(skb)->payload_len = htons(len);
+	ipv6_set_payload_len(ipv6_hdr(skb), skb->len - sizeof(struct ipv6hdr));
 	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
 
 	/* if egress device is enslaved to an L3 master device pass the
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index e8efe75d63b2..e62365d9103a 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -948,7 +948,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af,
 		*next_protocol = IPPROTO_IPV6;
 		if (payload_len)
 			*payload_len =
-				ntohs(old_ipv6h->payload_len) +
+				ipv6_payload_len(skb, old_ipv6h) +
 				sizeof(*old_ipv6h);
 		old_dsfield = ipv6_get_dsfield(old_ipv6h);
 		*ttl = old_ipv6h->hop_limit;
diff --git a/net/netfilter/nf_conntrack_ovs.c b/net/netfilter/nf_conntrack_ovs.c
index 068e9489e1c2..a6988eeb1579 100644
--- a/net/netfilter/nf_conntrack_ovs.c
+++ b/net/netfilter/nf_conntrack_ovs.c
@@ -121,7 +121,7 @@ int nf_ct_skb_network_trim(struct sk_buff *skb, int family)
 		len = skb_ip_totlen(skb);
 		break;
 	case NFPROTO_IPV6:
-		len = ntohs(ipv6_hdr(skb)->payload_len);
+		len = skb_ipv6_payload_len(skb);
 		if (ipv6_hdr(skb)->nexthdr == NEXTHDR_HOP) {
 			int err = nf_ip6_check_hbh_len(skb, &len);
 
diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c
index 9e1a6224d071..9e40d95dcb07 100644
--- a/net/netfilter/nf_log_syslog.c
+++ b/net/netfilter/nf_log_syslog.c
@@ -569,7 +569,7 @@ dump_ipv6_packet(struct net *net, struct nf_log_buf *m,
 
 	/* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
 	nf_log_buf_add(m, "LEN=%zu TC=%u HOPLIMIT=%u FLOWLBL=%u ",
-		       ntohs(ih->payload_len) + sizeof(struct ipv6hdr),
+		       ipv6_payload_len(skb, ih) + sizeof(struct ipv6hdr),
 		       (ntohl(*(__be32 *)ih) & 0x0ff00000) >> 20,
 		       ih->hop_limit,
 		       (ntohl(*(__be32 *)ih) & 0x000fffff));
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index 8db48f8ec81f..4db9ffb00abd 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1266,7 +1266,7 @@ static struct sk_buff *cake_ack_filter(struct cake_sched_data *q,
 			    ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr))
 				continue;
 
-			seglen = ntohs(ipv6h_check->payload_len);
+			seglen = ipv6_payload_len(skb, ipv6h_check);
 		} else {
 			WARN_ON(1);  /* shouldn't happen */
 			continue;
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (2 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:22   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add() Eva Kurchatova
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Joas Antonio dos Santos <joasantonio108@gmail.com>

[ Upstream commit 8070ed578b6b9134e045627fb745c887a806d46e ]

calipso_skbuff_setattr() adjusts payload_len by the length of the
option it inserts or resizes:

	payload = ntohs(ip6_hdr->payload_len);
	ip6_hdr->payload_len = htons(payload + len_delta);

GRO can build BIG TCP packets larger than IPV6_MAXPLEN, and stores
payload_len == 0 for them; ipv6_payload_len() then falls back to
skb->len.  For such a packet forwarded to a destination mapped to
CALIPSO, the code above writes len_delta (or 65536 + len_delta when
shrinking) into payload_len, and ipv6_payload_len() no longer falls
back to skb->len.  nf_tables, conntrack and sch_cake rely on it.

The same arithmetic also wraps when a packet grows past IPV6_MAXPLEN,
and a BIG TCP packet that shrinks below IPV6_MAXPLEN should get its
real length back.

Set payload_len from the skb length with ipv6_set_payload_len(), which
stores 0 above IPV6_MAXPLEN and the real length otherwise, as
ipv6_gro_complete() does.  The network header was just reset to
skb->data, so skb->len - sizeof(*ip6_hdr) is the payload length.

Tested on one kernel (arm64, QEMU) with SELinux permissive, a minimal
mdp-generated policy (network_peer_controls=1), "netlabelctl calipso
add pass doi:16" and a NetLabel mapping of fd00:2::/64 to CALIPSO
DOI 16.  calipso_skbuff_setattr() was called through
netlbl_skbuff_setattr() from a test-only debugfs hook (not part of
this patch) adding a level-only label; payload_len after the call:

  case                         before fix   after fix   real length
  1000, unlabeled                    1016        1016          1016
  70000 GSO, payload_len 0             16           0         70016
  65530 GSO, grows past MAXPLEN        10           0         65546
  65540 GSO with a 24 byte hop
  header, shrinks below MAXPLEN     65528       65532         65532
  1000 with a 24 byte hop header      992         992           992

(0 means ipv6_payload_len() returns the real length.)  On the forward
path, with a client injecting unlabeled UDP through a router to a
server, the router adds the CALIPSO option and the server delivers all
datagrams (Udp6InDatagrams 5, Ip6InTruncatedPkts 0) with this patch.

Fixes: 81fbc812132c ("ipv6/gro: insert temporary HBH/jumbo header")
Suggested-by: Eric Dumazet <edumazet@kernel.org>
Suggested-by: Wang Zhan <wang.zhan@smartx.com>
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Wang Zhan <wang.zhan@smartx.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/179156155963.36253.400481753322266658@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 929dc8e2c9165bb651dca26b2c68067a3880406b)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv6/calipso.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index f5cc02ea3092..3ab22f9b416e 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -1319,7 +1319,7 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
 	struct ipv6hdr *ip6_hdr;
 	struct ipv6_opt_hdr *hop;
 	unsigned char buf[CALIPSO_MAX_BUFFER];
-	int len_delta, new_end, pad, payload;
+	int len_delta, new_end, pad;
 	unsigned int start, end;
 
 	ip6_hdr = ipv6_hdr(skb);
@@ -1358,8 +1358,8 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
 			sizeof(*ip6_hdr) + start);
 		skb_reset_network_header(skb);
 		ip6_hdr = ipv6_hdr(skb);
-		payload = ntohs(ip6_hdr->payload_len);
-		ip6_hdr->payload_len = htons(payload + len_delta);
+		/* 0 above IPV6_MAXPLEN (BIG TCP), the real length otherwise */
+		ipv6_set_payload_len(ip6_hdr, skb->len - sizeof(*ip6_hdr));
 	}
 
 	hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add()
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (3 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr() Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:23   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option Eva Kurchatova
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Joas Antonio dos Santos <joasantonio108@gmail.com>

[ Upstream commit d538cc3ec0bc4cb7b40981b3213a6c6671959ed5 ]

calipso_cache_add() stores calipso_ptr + 2 as the cache key, but
computes entry->hash over calipso_ptr, i.e. starting two bytes earlier
at the option type and length.  calipso_opt_getattr() looks entries up
with calipso_cache_check(calipso + 2, calipso[1], ...), which hashes the
key itself.

The two hashes only match on a jhash collision, so the CALIPSO label
cache never hits and every labelled packet takes the full DOI lookup and
category conversion path.  The memcmp() on the key keeps lookups
correct, so this is a performance bug only.

Hash the stored key, as cipso_v4_cache_add() does for CIPSO.

Fixes: 4fee5242bf41 ("calipso: Add a label cache.")
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/179138670045.80227.16155454353416856947@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 75cdfd788d6d5b6891a52f4bf3946d74cf47fb1b)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv6/calipso.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index 3ab22f9b416e..f3a983aa0703 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -284,7 +284,7 @@ static int calipso_cache_add(const unsigned char *calipso_ptr,
 		goto cache_add_failure;
 	}
 	entry->key_len = calipso_ptr_len;
-	entry->hash = calipso_map_cache_hash(calipso_ptr, calipso_ptr_len);
+	entry->hash = calipso_map_cache_hash(entry->key, calipso_ptr_len);
 	refcount_inc(&secattr->cache->refcount);
 	entry->lsm_data = secattr->cache;
 
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (4 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add() Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:25   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener Eva Kurchatova
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Joas Antonio dos Santos <joasantonio108@gmail.com>

[ Upstream commit 00accbd9d5021b942a16078bd5717d7865f6971c ]

calipso_skbuff_delattr() removes the CALIPSO option from the hop-by-hop
extension header, or the whole extension header if CALIPSO is its only
option, and pulls the skb by the removed length.  It never updates
ipv6hdr->payload_len, so after a successful removal the header still
claims the original length.

calipso_skbuff_setattr() already adjusts payload_len by the length it
adds; the delete path was missed.

This is reached on the forward path when a packet carrying CALIPSO is
sent to a destination mapped to an unlabeled NetLabel domain.  The
forwarded packet then has a payload_len larger than its real payload
by the removed length (8 to 264 bytes), and the receiver drops it as
truncated.  So removing the label on the forward path has been broken
for every packet that is not resegmented later (SYN, UDP, ICMPv6...).

Adjust payload_len after the header is moved.  BIG TCP packets carry
payload_len == 0 (see ipv6_set_payload_len()), and ipv6_payload_len()
then falls back to skb->len, so leave them alone.

Tested with client, router and server network namespaces on one kernel
(arm64, QEMU): SELinux permissive with a minimal mdp-generated policy
(network_peer_controls=1), "netlabelctl calipso add pass doi:16", the
default NetLabel mapping left unlabeled, IPv6 forwarding on the router.
The client sends 5 UDP datagrams with a CALIPSO hop-by-hop option
(DOI 16, set through IPV6_HOPOPTS) to the server through the router:

  before: router Ip6OutForwDatagrams 5, server receives 0,
          server Ip6InTruncatedPkts 5
  after:  router Ip6OutForwDatagrams 5, server receives 5,
          server Ip6InTruncatedPkts 0

Fixes: 2917f57b6bc1 ("calipso: Allow the lsm to label the skbuff directly.")
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Link: https://patch.msgid.link/179147329205.58079.5847298721173675285@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8dcd1a626da5fbde8788c9ba0585881ce446642e)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv6/calipso.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index f3a983aa0703..78a96469d6c8 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -1429,6 +1429,10 @@ static int calipso_skbuff_delattr(struct sk_buff *skb)
 		skb_pull(skb, delta);
 		memmove((char *)ip6_hdr + delta, ip6_hdr, size);
 		skb_reset_network_header(skb);
+		ip6_hdr = ipv6_hdr(skb);
+		/* BIG TCP packets have payload_len == 0 */
+		if (ip6_hdr->payload_len)
+			be16_add_cpu(&ip6_hdr->payload_len, -delta);
 	}
 
 	return 0;
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (5 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:25   ` no-reply
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails Eva Kurchatova
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Hyunwoo Kim <imv4bel@gmail.com>

When a valid RST is received for a Fast Open child accepted before the
three-way handshake completes, reqsk_fastopen_remove() adds the
request_sock to the listener's RST list if the listener is in TCP_LISTEN.

An application can call shutdown(SHUT_RD) on a listener socket.
inet_csk_listen_stop() checks rskq_rst_head without holding
fastopenq.lock. If rskq_rst_head is NULL, it does not acquire the lock
and therefore does not synchronize with an insertion by
reqsk_fastopen_remove() after that function has passed the TCP_LISTEN
check.

The more likely outcome of this race, even without a subsequent
listen(), is a leak. If reqsk_fastopen_remove() inserts a request_sock
after inet_csk_listen_stop() observes an empty list and returns, the
request_sock is stranded in rskq_rst_head and keeps a reference on the
listener. The socket is already in TCP_CLOSE, so a subsequent close()
does not call inet_csk_listen_stop() again.

If listen() is called again on the same socket before the delayed list
insertion, the insertion can overlap the queue initialization in
reqsk_queue_alloc(). If it occurs after rskq_rst_head is set to NULL but
before rskq_rst_tail is set to NULL, rskq_rst_head points to the
request_sock while rskq_rst_tail is NULL.

When a valid RST is later received for another accepted Fast Open child,
rskq_rst_head is not NULL, so reqsk_fastopen_remove() attempts to write
the request_sock pointer to rskq_rst_tail->dl_next while rskq_rst_tail is
NULL. KASAN reports:

  BUG: KASAN: null-ptr-deref in reqsk_fastopen_remove+0x147/0x210
  Write of size 8 at addr 0000000000000088 by task swapper/3/0
  ...
  Call Trace:
   <IRQ>
   ...
   reqsk_fastopen_remove+0x147/0x210
   tcp_check_req+0xa70/0x1060
   ...
   tcp_rcv_state_process+0x1cb/0x2ae0
   ...
   tcp_v4_do_rcv+0x1fe/0x740
   tcp_v4_rcv+0x1744/0x2070
   ...
   ip_protocol_deliver_rcu+0x5c/0x280
   ip_local_deliver_finish+0x171/0x330
   ip_local_deliver+0x107/0x370
   ...
   </IRQ>

To widen the race window, the issue was reproduced after adding
mdelay(3000) immediately after reqsk_fastopen_remove() checks that the
listener is in TCP_LISTEN and immediately after reqsk_queue_alloc() sets
rskq_rst_head to NULL.

Make inet_csk_listen_stop() acquire fastopenq.lock regardless of the
value of rskq_rst_head and detach the list while holding the lock. With
this synchronization, reqsk_fastopen_remove() either inserts the
request_sock before inet_csk_listen_stop() acquires the lock, in which
case inet_csk_listen_stop() reclaims it, or sees that the listener is
not in TCP_LISTEN and does not insert anything.

Fixes: 0536fcc039a8 ("tcp: prepare fastopen code for upcoming listener changes")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/avMkfJrXhCFXn8M_@v4bel
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit aa40afa831ebfe45e40a23721711059f2ac584d4)

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv4/inet_connection_sock.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 156467ab4384..dedbf38535db 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1511,17 +1511,15 @@ void inet_csk_listen_stop(struct sock *sk)
 		if (!has_current_bpf_ctx())
 			cond_resched();
 	}
-	if (queue->fastopenq.rskq_rst_head) {
-		/* Free all the reqs queued in rskq_rst_head. */
-		spin_lock_bh(&queue->fastopenq.lock);
-		req = queue->fastopenq.rskq_rst_head;
-		queue->fastopenq.rskq_rst_head = NULL;
-		spin_unlock_bh(&queue->fastopenq.lock);
-		while (req != NULL) {
-			next = req->dl_next;
-			reqsk_put(req);
-			req = next;
-		}
+	/* Free all the reqs queued in rskq_rst_head. */
+	spin_lock_bh(&queue->fastopenq.lock);
+	req = queue->fastopenq.rskq_rst_head;
+	queue->fastopenq.rskq_rst_head = NULL;
+	spin_unlock_bh(&queue->fastopenq.lock);
+	while (req != NULL) {
+		next = req->dl_next;
+		reqsk_put(req);
+		req = next;
 	}
 	WARN_ON_ONCE(sk->sk_ack_backlog);
 }
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (6 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener Eva Kurchatova
@ 2026-11-30 18:45 ` Eva Kurchatova
  2026-12-01  1:28   ` no-reply
  2026-12-01 11:37 ` [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova (Virtuozzo)
  2026-12-01 15:42 ` Eva Kurchatova (Virtuozzo)
  9 siblings, 1 reply; 19+ messages in thread
From: Eva Kurchatova @ 2026-11-30 18:45 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

From: Eric Dumazet <edumazet@kernel.org>

inet_csk_listen_start() moves the socket to TCP_LISTEN before calling
->get_port() and ->hash(). If one of them fails, the socket goes back
to TCP_CLOSE without going through inet_csk_listen_stop().

If the socket was a Fast Open listener in a previous life, and was
stopped with shutdown(SHUT_RD) or connect(AF_UNSPEC) while an accepted
Fast Open child was still in TCP_SYN_RECV state, the request_sock of
this child still points to the listener.

A valid RST received for this child while the listener is transiently
in TCP_LISTEN state makes reqsk_fastopen_remove() queue the
request_sock in rskq_rst_head. When listen() fails, for instance with
-EADDRINUSE because another SO_REUSEADDR socket started listening on
the same port, nothing reclaims it:

- __tcp_close(), tcp_disconnect() and tcp_abort() only call
  inet_csk_listen_stop() for sockets in TCP_LISTEN state.

- A later successful listen() overwrites rskq_rst_head in
  reqsk_queue_alloc().

The request_sock is leaked, together with the reference it holds
on the listener.

Move the rskq_rst_head purge to a helper, and call it from the
inet_csk_listen_start() error path as well, after the socket state
has been set back to TCP_CLOSE: reqsk_fastopen_remove() checks
sk_state under fastopenq.lock, so it either queued the request before
the purge acquires the lock, or does not queue it at all.

Reported-by: Sashiko AI review <netdev-bot+sashiko@kernel.org>
Closes: https://lore.kernel.org/netdev/179450310167.2199510.18107423940014989443@kernel.org/
Fixes: 0536fcc039a8 ("tcp: prepare fastopen code for upcoming listener changes")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261114111247.21995-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 342e62fd34c2674e82bffc89cb5c7091924986d9)

Rebase note: conflict in context only. reqsk_queue_alloc(), next to
which upstream adds reqsk_fastopen_purge_rst(), is still in
net/core/request_sock.c here; d5c539155431 ("inet: move
reqsk_queue_alloc() to net/ipv4/inet_connection_sock.c") is not taken.

https://virtuozzo.atlassian.net/browse/VSTOR-157577
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/ipv4/inet_connection_sock.c | 35 ++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index dedbf38535db..1ee030974faf 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1315,6 +1315,22 @@ static int inet_ulp_can_listen(const struct sock *sk)
 	return 0;
 }
 
+/* Free all the reqs queued in rskq_rst_head. */
+static void reqsk_fastopen_purge_rst(struct request_sock_queue *queue)
+{
+	struct request_sock *next, *req;
+
+	spin_lock_bh(&queue->fastopenq.lock);
+	req = queue->fastopenq.rskq_rst_head;
+	queue->fastopenq.rskq_rst_head = NULL;
+	spin_unlock_bh(&queue->fastopenq.lock);
+	while (req != NULL) {
+		next = req->dl_next;
+		reqsk_put(req);
+		req = next;
+	}
+}
+
 int inet_csk_listen_start(struct sock *sk)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
@@ -1348,6 +1364,12 @@ int inet_csk_listen_start(struct sock *sk)
 	}
 
 	inet_sk_set_state(sk, TCP_CLOSE);
+
+	/* A Fast Open child accepted before a previous shutdown() of this
+	 * listener might have queued its request in rskq_rst_head while
+	 * we were transiently in TCP_LISTEN state.
+	 */
+	reqsk_fastopen_purge_rst(&icsk->icsk_accept_queue);
 	return err;
 }
 EXPORT_SYMBOL_GPL(inet_csk_listen_start);
@@ -1455,7 +1477,7 @@ void inet_csk_listen_stop(struct sock *sk)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	struct request_sock_queue *queue = &icsk->icsk_accept_queue;
-	struct request_sock *next, *req;
+	struct request_sock *req;
 
 	/* Following specs, it would be better either to send FIN
 	 * (and enter FIN-WAIT-1, it is normal close)
@@ -1511,16 +1533,7 @@ void inet_csk_listen_stop(struct sock *sk)
 		if (!has_current_bpf_ctx())
 			cond_resched();
 	}
-	/* Free all the reqs queued in rskq_rst_head. */
-	spin_lock_bh(&queue->fastopenq.lock);
-	req = queue->fastopenq.rskq_rst_head;
-	queue->fastopenq.rskq_rst_head = NULL;
-	spin_unlock_bh(&queue->fastopenq.lock);
-	while (req != NULL) {
-		next = req->dl_next;
-		reqsk_put(req);
-		req = next;
-	}
+	reqsk_fastopen_purge_rst(queue);
 	WARN_ON_ONCE(sk->sk_ack_backlog);
 }
 EXPORT_SYMBOL_GPL(inet_csk_listen_stop);
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
@ 2026-12-01  1:17   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:17 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Sechang Lim <rhkrqnwk98@gmail.com>
> 
> [ Upstream commit 990348e5bb457697c2f1f7f7b65154a3334d9d2b ]
> 
> A child socket inherits the listener's bpf_sock_ops_cb_flags via
> sk_clone_lock(). If its setup fails in tcp_v4_syn_recv_sock() /
> tcp_v6_syn_recv_sock(), the child is freed through put_and_exit, where
> inet_csk_prepare_forced_close() drops the socket lock and tcp_done() runs
> without it.
> 
> If BPF_SOCK_OPS_STATE_CB_FLAG was inherited, tcp_done() -> tcp_set_state()
> calls tcp_call_bpf(), which expects the lock and trips sock_owned_by_me():
> 
>   WARNING: include/net/sock.h:1799 at tcp_set_state+0x433/0x550
>   RIP: 0010:tcp_set_state+0x433/0x550 include/net/sock.h:1799
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context Eva Kurchatova
@ 2026-12-01  1:18   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:18 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Jiayuan Chen <jiayuan.chen@linux.dev>
> 
> [ Upstream commit eaab8cab451b9502ce224cd202550375b894a467 ]
> 
> bpf_sock_destroy() runs from the tcp iterator, under rcu_read_lock(). If
> the sock is a listener that still has children in its accept queue,
> tcp_abort() ends up in inet_csk_listen_stop() and the cond_resched()
> there trips the debug check:
> 
> BUG: sleeping function called from invalid context at net/ipv4/inet_connection_sock.c:1523
> in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 628, name: test_progs
> preempt_count: 0, expected: 0
> RCU nest depth: 1, expected: 0
> locks held by test_progs/628: 3, last CPU#3:
>  #0: ffff8881158cee18 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x56/0x1210
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=2


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers Eva Kurchatova
@ 2026-12-01  1:21   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:21 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] sch_cake: cake_ack_filter() passes tail skb to
  ipv6_payload_len() for queued skb header
- [Low] ipv6: payload_len helper changes trim behaviour for GSO TCP
  skbs, contrary to 'no behavioral change'
--

commit 4ea80ca90ac26540568220de28fd73c759be5f1a
Author: Alice Mikityanska <alice@isovalent.com>

ms/net/ipv6: Introduce payload_len helpers

This adds ipv6_payload_len(), skb_ipv6_payload_len() and ipv6_set_payload_len(). They wrap ip6->payload_len, and fall back to a length computed from skb->len when payload_len is zero. The commit converts the IPv6 paths that can see BIG TCP packets to use them.

Link: https://patch.msgid.link/20260205133925.526371-2-alice.kernel@fastmail.im

> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
> index a6e2aadbb91bd..d960b887469d0 100644
> --- a/include/linux/ipv6.h
> +++ b/include/linux/ipv6.h
> @@ -125,6 +125,28 @@ static inline unsigned int ipv6_transport_len(const struct sk_buff *skb)
>  	       skb_network_header_len(skb);
>  }
>  
> +static inline unsigned int
> +ipv6_payload_len(const struct sk_buff *skb, const struct ipv6hdr *ip6)
> +{
> +	u32 len = ntohs(ip6->payload_len);
> +
> +	return (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?
> +		len :
> +		skb->len - skb_network_offset(skb) - sizeof(struct ipv6hdr);
> +}
> +

[ ... ]

> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 0b3b81fd4a58a..9c2be98b961ad 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -262,7 +262,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
>  	skb->transport_header = skb->network_header + sizeof(*hdr);
>  	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
>  
> -	pkt_len = ntohs(hdr->payload_len);
> +	pkt_len = ipv6_payload_len(skb, hdr);
>  
>  	/* pkt_len may be zero if Jumbo payload option is present */
>  	if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {

[Severity: Low]
Is the "No behavioral change" statement in the commit message accurate?

ipv6_payload_len() falls back to skb->len for any GSO TCP skb with payload_len == 0. It does not require a hop-by-hop jumbo header. Take a GSO TCPv6 skb with payload_len == 0 and nexthdr != NEXTHDR_HOP, for example one injected by a tap or virtio sender. Before the patch, ip6_rcv_core() saw pkt_len == 0 and trimmed the skb to the bare IPv6 header. Now pkt_len is skb->len minus the header, so no trim happens and the skb keeps its full length. br_validate_ipv6() and the other converted callers change in the same way.

Could the commit message describe this change, or could the helper be restricted to the cases the series targets?

[ ... ]

> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 8db48f8ec81fb..4db9ffb00abd8 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -1266,7 +1266,7 @@ static struct sk_buff *cake_ack_filter(struct cake_sched_data *q,
>  			    ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr))
>  				continue;
>  
> -			seglen = ntohs(ipv6h_check->payload_len);
> +			seglen = ipv6_payload_len(skb, ipv6h_check);
>  		} else {
>  			WARN_ON(1);  /* shouldn't happen */
>  			continue;

[Severity: Low]
Does this read the length from the wrong skb? ipv6h_check is the header of skb_check, but skb is the triggering tail skb.

Take a queued BIG TCP GSO skb with payload_len == 0 when ack-filter is on and split-gso is off. The fallback then uses skb->len and skb_network_offset() of the tail. Suppose the tail is a small pure ACK of the same 5-tuple. Then seglen ends up equal to the tail's TCP header length, so the later (seglen - __tcp_hdrlen(tcph_check)) != 0 test can pass. The queued data skb may then be treated as a pure ACK and dropped, forcing a retransmit. Before the patch, seglen was 0 for such a skb, so it was never eligible.

Should this pass skb_check instead of skb? The IPv4 line next to it, iph_totlen(skb, iph_check), has the same mismatch. This patch did not introduce it.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr() Eva Kurchatova
@ 2026-12-01  1:22   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:22 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Joas Antonio dos Santos <joasantonio108@gmail.com>
> 
> [ Upstream commit 8070ed578b6b9134e045627fb745c887a806d46e ]
> 
> calipso_skbuff_setattr() adjusts payload_len by the length of the
> option it inserts or resizes:
> 
> 	payload = ntohs(ip6_hdr->payload_len);
> 	ip6_hdr->payload_len = htons(payload + len_delta);
> 
> GRO can build BIG TCP packets larger than IPV6_MAXPLEN, and stores
> payload_len == 0 for them; ipv6_payload_len() then falls back to
> skb->len.  For such a packet forwarded to a destination mapped to
> CALIPSO, the code above writes len_delta (or 65536 + len_delta when
> shrinking) into payload_len, and ipv6_payload_len() no longer falls
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=4


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add()
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add() Eva Kurchatova
@ 2026-12-01  1:23   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:23 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Joas Antonio dos Santos <joasantonio108@gmail.com>
> 
> [ Upstream commit d538cc3ec0bc4cb7b40981b3213a6c6671959ed5 ]
> 
> calipso_cache_add() stores calipso_ptr + 2 as the cache key, but
> computes entry->hash over calipso_ptr, i.e. starting two bytes earlier
> at the option type and length.  calipso_opt_getattr() looks entries up
> with calipso_cache_check(calipso + 2, calipso[1], ...), which hashes the
> key itself.
> 
> The two hashes only match on a jhash collision, so the CALIPSO label
> cache never hits and every labelled packet takes the full DOI lookup and
> category conversion path.  The memcmp() on the key keeps lookups
> correct, so this is a performance bug only.
> 
> Hash the stored key, as cipso_v4_cache_add() does for CIPSO.
> 
> Fixes: 4fee5242bf41 ("calipso: Add a label cache.")
> Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
> Assisted-by: Claude:claude-opus-5-5
> Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
> Link: https://patch.msgid.link/179138670045.80227.16155454353416856947@gmail.com
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> (cherry picked from commit 75cdfd788d6d5b6891a52f4bf3946d74cf47fb1b)
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=5


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option Eva Kurchatova
@ 2026-12-01  1:25   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:25 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Joas Antonio dos Santos <joasantonio108@gmail.com>
> 
> [ Upstream commit 00accbd9d5021b942a16078bd5717d7865f6971c ]
> 
> calipso_skbuff_delattr() removes the CALIPSO option from the hop-by-hop
> extension header, or the whole extension header if CALIPSO is its only
> option, and pulls the skb by the removed length.  It never updates
> ipv6hdr->payload_len, so after a successful removal the header still
> claims the original length.
> 
> calipso_skbuff_setattr() already adjusts payload_len by the length it
> adds; the delete path was missed.
> 
> This is reached on the forward path when a packet carrying CALIPSO is
> sent to a destination mapped to an unlabeled NetLabel domain.  The
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=6


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener Eva Kurchatova
@ 2026-12-01  1:25   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:25 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Hyunwoo Kim <imv4bel@gmail.com>
> 
> When a valid RST is received for a Fast Open child accepted before the
> three-way handshake completes, reqsk_fastopen_remove() adds the
> request_sock to the listener's RST list if the listener is in TCP_LISTEN.
> 
> An application can call shutdown(SHUT_RD) on a listener socket.
> inet_csk_listen_stop() checks rskq_rst_head without holding
> fastopenq.lock. If rskq_rst_head is NULL, it does not acquire the lock
> and therefore does not synchronize with an insertion by
> reqsk_fastopen_remove() after that function has passed the TCP_LISTEN
> check.
> 
> The more likely outcome of this race, even without a subsequent
> listen(), is a leak. If reqsk_fastopen_remove() inserts a request_sock
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=7


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails Eva Kurchatova
@ 2026-12-01  1:28   ` no-reply
  0 siblings, 0 replies; 19+ messages in thread
From: no-reply @ 2026-12-01  1:28 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko, vladimir.riabchun; +Cc: devel

> From: Eric Dumazet <edumazet@kernel.org>
> 
> inet_csk_listen_start() moves the socket to TCP_LISTEN before calling
> ->get_port() and ->hash(). If one of them fails, the socket goes back
> to TCP_CLOSE without going through inet_csk_listen_stop().
> 
> If the socket was a Fast Open listener in a previous life, and was
> stopped with shutdown(SHUT_RD) or connect(AF_UNSPEC) while an accepted
> Fast Open child was still in TCP_SYN_RECV state, the request_sock of
> this child still points to the listener.
> 
> A valid RST received for this child while the listener is transiently
> in TCP_LISTEN state makes reqsk_fastopen_remove() queue the
> request_sock in rskq_rst_head. When listen() fails, for instance with
> -EADDRINUSE because another SO_REUSEADDR socket started listening on
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-157577
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=8


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (7 preceding siblings ...)
  2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails Eva Kurchatova
@ 2026-12-01 11:37 ` Eva Kurchatova (Virtuozzo)
  2026-12-01 15:42 ` Eva Kurchatova (Virtuozzo)
  9 siblings, 0 replies; 19+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-12-01 11:37 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel


On 11/30/26 20:45, Eva Kurchatova wrote:
> Patchset for task https://virtuozzo.atlassian.net/jira/browse/VSTOR-157577
>
> Alice Mikityanska (1):
>    ms/net/ipv6: Introduce payload_len helpers
>
> Eric Dumazet (1):
>    ms/tcp: purge Fast Open RST queue when listen() fails
>
> Hyunwoo Kim (1):
>    ms/tcp: fix NULL pointer dereference when restarting a Fast Open
>      listener
>
> Jiayuan Chen (1):
>    ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF
>      context
>
> Joas Antonio dos Santos (3):
>    ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()
>    ms/calipso: hash the cache key, not the option start, in
>      calipso_cache_add()
>    ms/calipso: update payload_len when removing the CALIPSO option
>
> Sechang Lim (1):
>    ms/tcp: clear sock_ops cb flags before force-closing a child socket
>
>   include/linux/ipv6.h                       | 22 ++++++++++
>   include/net/inet_connection_sock.h         |  8 +---
>   include/net/ipv6.h                         |  2 -
>   include/net/netfilter/nf_tables_ipv6.h     |  4 +-
>   include/net/tcp.h                          |  9 ++++
>   net/bridge/br_netfilter_ipv6.c             |  2 +-
>   net/bridge/netfilter/nf_conntrack_bridge.c |  4 +-
>   net/ipv4/inet_connection_sock.c            | 49 +++++++++++++++-------
>   net/ipv6/calipso.c                         | 12 ++++--
>   net/ipv6/ip6_input.c                       |  2 +-
>   net/ipv6/ip6_offload.c                     |  7 ++--
>   net/ipv6/output_core.c                     |  7 +---
>   net/netfilter/ipvs/ip_vs_xmit.c            |  2 +-
>   net/netfilter/nf_conntrack_ovs.c           |  2 +-
>   net/netfilter/nf_log_syslog.c              |  2 +-
>   net/sched/sch_cake.c                       |  2 +-
>   16 files changed, 89 insertions(+), 47 deletions(-)


Do not merge yet; Will follow up with a v2 with additional patches on 
top to cover other dependent tasks.

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes
  2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
                   ` (8 preceding siblings ...)
  2026-12-01 11:37 ` [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova (Virtuozzo)
@ 2026-12-01 15:42 ` Eva Kurchatova (Virtuozzo)
  9 siblings, 0 replies; 19+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-12-01 15:42 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel


On 11/30/26 20:45, Eva Kurchatova wrote:
> Patchset for task https://virtuozzo.atlassian.net/jira/browse/VSTOR-157577
>
> Alice Mikityanska (1):
>    ms/net/ipv6: Introduce payload_len helpers
>
> Eric Dumazet (1):
>    ms/tcp: purge Fast Open RST queue when listen() fails
>
> Hyunwoo Kim (1):
>    ms/tcp: fix NULL pointer dereference when restarting a Fast Open
>      listener
>
> Jiayuan Chen (1):
>    ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF
>      context
>
> Joas Antonio dos Santos (3):
>    ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()
>    ms/calipso: hash the cache key, not the option start, in
>      calipso_cache_add()
>    ms/calipso: update payload_len when removing the CALIPSO option
>
> Sechang Lim (1):
>    ms/tcp: clear sock_ops cb flags before force-closing a child socket
>
>   include/linux/ipv6.h                       | 22 ++++++++++
>   include/net/inet_connection_sock.h         |  8 +---
>   include/net/ipv6.h                         |  2 -
>   include/net/netfilter/nf_tables_ipv6.h     |  4 +-
>   include/net/tcp.h                          |  9 ++++
>   net/bridge/br_netfilter_ipv6.c             |  2 +-
>   net/bridge/netfilter/nf_conntrack_bridge.c |  4 +-
>   net/ipv4/inet_connection_sock.c            | 49 +++++++++++++++-------
>   net/ipv6/calipso.c                         | 12 ++++--
>   net/ipv6/ip6_input.c                       |  2 +-
>   net/ipv6/ip6_offload.c                     |  7 ++--
>   net/ipv6/output_core.c                     |  7 +---
>   net/netfilter/ipvs/ip_vs_xmit.c            |  2 +-
>   net/netfilter/nf_conntrack_ovs.c           |  2 +-
>   net/netfilter/nf_log_syslog.c              |  2 +-
>   net/sched/sch_cake.c                       |  2 +-
>   16 files changed, 89 insertions(+), 47 deletions(-)

Follow-up: 
http://lore.virtuozzo.com/kernel/20261201153749.2872789-1-eva.kurchatova@virtuozzo.com/T/#t

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-12-01 15:43 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
2026-12-01  1:17   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context Eva Kurchatova
2026-12-01  1:18   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers Eva Kurchatova
2026-12-01  1:21   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr() Eva Kurchatova
2026-12-01  1:22   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add() Eva Kurchatova
2026-12-01  1:23   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option Eva Kurchatova
2026-12-01  1:25   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener Eva Kurchatova
2026-12-01  1:25   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails Eva Kurchatova
2026-12-01  1:28   ` no-reply
2026-12-01 11:37 ` [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova (Virtuozzo)
2026-12-01 15:42 ` Eva Kurchatova (Virtuozzo)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox