From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796121614; b=wb2BwH28TUvFAbrCNUAlFEx5pNJtb5yc3mQa6Y9AFmEfJbdDg1F+UIABou1gRaBbI4eI cI84zLYzpuDkHETppXtGbH92RFbFOzsqCzmi7YJ61VofvGu1NVikP1Uh8KAoToQJ2uWxZ Te+1y3nZgOhax+nmuuwsQNMijJKbSQDx1kMWcHKLkHlNKYEg2RB39H5wplq85qThoIl8A t6s39kggxoKvXfupUn0dUtd8vgJQQEmEIdLjqeweMX0FvURljuM3K26HaRejUSzkjpE6R adij+Ni2VSPJbc8X862LcqZ8MeSWQKnYvBfLU2odznnXT5dV3h1mgOXCWPzQ2zWn57A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121614; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=YCXdbz2Yd/n1B86aQjkPEPCeCi+Ymw72opoEPb2NWfs=; b=K5vipCx9CbP5wSMflx3Mib7IqfqfuYkpPcF9i60MsZgbI5drbUpX5STT1xlVo9Zz9cKs PjmJFhXgRIFufZB/ybKKlldz+mGSn+T5I02u4n1sycscnUyTkMxChfhJQ3xRy+a6Wo8lp 9Qtt7nUPEcMcRQDgmnqi3xISf+Errln9ZEMAdW3jWFrsDLynn8BoC6MDixCi9byYccMoV mp/ih8UdOi92KaApMD84NC/RI0ooe/oGrSd4dNykF48FuvMFET0WMKhBER//pxsd6KFVJ k6gY+kLH9z+uTF+HZ8+VZAriBywzmkTK82017fcuUm8mDfqxysqnAka43knNEbVwdgw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=HD7atIMM; arc=none smtp.remote-ip=209.85.214.198 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 506EF606A32D for ; Tue, 1 Dec 2026 10:40:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 506EF606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=HD7atIMM Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2f03a137f6aso99392785ad.3 for ; Tue, 01 Dec 2026 02:40:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796121613; x=1796726413; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=YCXdbz2Yd/n1B86aQjkPEPCeCi+Ymw72opoEPb2NWfs=; b=HD7atIMM1MSbE2F2E1VajEVbZW10JazmFlwlTrlwtXatUEOocBoML0E+dfXYNc1gxo dlCnGnREgjAyIznVkvHkMzynSbIk3E0OV8wzc4qPOKBipvaF5tW52Rg6MbcAfJ2HBTAl j76eiqQ+0h3oGq2XzB55Ah1cETXSMk7fixHOnZEXVqF14Gsenx3HKNY/kV7VAk8THGK1 ywDDEEMXv1Iu8/8qBTSL8/3oinfyjVZTd1KXyZkx2nrJxFCGyoQunw4jynbaMT0YCfxi c5ngA+vfuUGGjkwagznlyYAaY70y/kVH8MsV+ZlrCXLDGfjA/3GxAr7fgXgZIX1yu8Zv zgnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796121613; x=1796726413; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=YCXdbz2Yd/n1B86aQjkPEPCeCi+Ymw72opoEPb2NWfs=; b=dsq4WcCrdcxxQlwNO5rywDCQPIBl+DF7yOBmPnhZrBCtTXX+DuqSj4R8DjFEgRqC71 vIce9VgXWK34F3Wyx44HfZmyxIWH99BUwzcJ5PkarXinfZsXwAZOqFkQsDow4Gicq+t/ lxkqG8LITAW8j+nm/NxM+Ds6TXeYozw1YjrL86Yt0/15+rOOTmcubf5De3JCZg5ql4w1 kMdVcPEcajzR6I87MXQDyp3Dx3LuRNZRVvY29VMsxa6CqheOC8INIaHAd3q6Y2U4XZI7 DPRaPArn765+ARU+OUtrPP5ttv+gArlmrcwF7/VZO6xSW7xCGRrXUNWcX+xk1Vfny/WX 194g== X-Forwarded-Encrypted: i=1; AL+hErEn3c03yRXjgL8Tt/+Q3adREx6bsiKfSoydCko7Pn2QehRmp++4QI9VdNx/5Q4cy6umBU+jOY0=@vger.kernel.org X-Gm-Message-State: APuU4Z/aepDlIStSsFClTKCz02T2Fh+vC5mEE6+XgfAfYkgi6Y3paIFd 9eSP+ZrsCToAt3KRfYWw16qXnZ1h2n57yUAqIQzNb6u5/rz4sD16PufTfzzJLv1667X8uM1PLD6 SWnYW9Q== X-Received: from plhc4.prod.google.com ([2002:a17:903:2344:b0:2f0:37ba:7b3a]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2b0f:b0:2ef:d9b8:463 with SMTP id d9443c01a7336-2f03f186250mr383243635ad.35.1796121613152; Tue, 01 Dec 2026 02:40:13 -0800 (PST) Date: Tue, 1 Dec 2026 19:40:10 +0900 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261201104011.2286047-1-kuniyu@google.com> Subject: [PATCH v1 net] tcp: Skip active TFO blackhole detection for passive sockets. From: Kuniyuki Iwashima To: Eric Dumazet , Neal Cardwell , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Willem de Bruijn Cc: Simon Horman , Yuchung Cheng , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" tcp_fastopen_active_detect_blackhole() checks tp->syn_fastopen, tp->syn_data, and tp->syn_data_acked to pause active Fast Open globally when an outbound TFO connection hits consecutive timeouts. However, tcp_fastopen_add_skb() also sets tp->syn_data_acked to 1 on passive child sockets when accepting data in SYN. When such a passive socket later hits consecutive RTOs, tcp_fastopen_active_detect_blackhole() misidentifies it as an active client socket and calls tcp_fastopen_active_disable(), disabling active TFO for the entire netns. This can be reproduced with the script below: 0 `sysctl -q net.ipv4.tcp_fastopen=0x203 \ net.ipv4.tcp_fastopen_blackhole_timeout_sec=3600 \ net.ipv4.tcp_early_retrans=0` +0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0 +0 listen(3, 1) = 0 +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0 +0 < S 0:1000(1000) win 32792 +0 > S. 0:0(0) ack 1001 <...> +0 accept(3, ..., ...) = 4 +0 %{ assert (tcpi_options & TCPI_OPT_SYN_DATA) != 0, tcpi_options }% +0 read(4, ..., 1024) = 1000 +0 < . 1001:1001(0) ack 1 win 5840 +0 write(4, ..., 1000) = 1000 +0 > P. 1:1001(1000) ack 1001 +.2 > P. 1:1001(1000) ack 1001 +.4 > P. 1:1001(1000) ack 1001 +.8 > P. 1:1001(1000) ack 1001 +0 `nstat -z -a TcpExtTCPFastOpenBlackhole TcpExtTCPFastOpenActiveFail \ | grep -E "TcpExtTCPFastOpen(Blackhole|ActiveFail)\s+1"` Without the fix, the last nstat shows these incremented by a passive TFO sk: TcpExtTCPFastOpenActiveFail 1 0.0 TcpExtTCPFastOpenBlackhole 1 0.0 Let's skip passive TFO sk in tcp_fastopen_active_detect_blackhole(). Note that tcp_rcv_fastopen_synack() sets tp->syn_data_acked to tp->syn_data so there is no path where only tp->syn_data_acked is set to 1 on the active side. We could check tp->syn_fastopen_child and return early but removing tp->syn_data_acked check is stable-friendly. Fixes: 7268586baa53 ("tcp: pause Fast Open globally after third consecutive timeout") Signed-off-by: Kuniyuki Iwashima --- Found by LLM with packetdrill --- net/ipv4/tcp_fastopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 7f7eb3cc1c04..61e57f21e4e4 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c @@ -685,7 +685,7 @@ void tcp_fastopen_active_detect_blackhole(struct sock *sk, bool expired) * Fast Open globally after hitting the third consecutive timeout or * exceeding the configured timeout limit. */ - if ((tp->syn_fastopen || tp->syn_data || tp->syn_data_acked) && + if ((tp->syn_fastopen || tp->syn_data) && (timeouts == 2 || (timeouts < 2 && expired))) { tcp_fastopen_active_disable(sk); NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVEFAIL); -- 2.56.1.839.g22a8290db9-goog