From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.250 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381088; b=z9YCetlMAoDEUXMrmuwCTSyxlpJ95a0x6DA5elqeKAy3PNW/HXHZK2+QVRDk8AaZsHPn +bmHZAdLZYSKkvwccbXkmKutY/QnTdvaElRZ2blcd/mLCf51xsuf5b44386vV/9JTEepT EYTWsejDdCDrWvBn/AC2z+Ut2BiIQITo/ockR6NbPHnJ5nJMAULHjRWNxu0LMW8gE3eg3 /kiTBOF3P6zyrVtlVixDfypkfQ6TjkJJzyyhJcO7Pkc6W2Oec9OgrPOVHRlD2O17pBHzK eUGaIOX/YuBqBkF3mIpBNYg51WN6ueK2EjO2pL+IIHXJbbA+BZo002Q84kwwUfet6PQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381088; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=AiKrdt36dOKxKzi16v3J3Zj1GoHYxYCg/bLIKgNzo/I=; b=POM5WRJhpxS+fPCY7WVzhDR1KAxg0VKg4Zr7TXdcSYilHy2TMm55iA2AjxJwW4slD3KF 4uP2vg+25ho/VuYn4MR4rmtK1pghh3QAM0EU9bb0YdFZT+MfbBy9A2YcT6mhDIHkRRtA/ GuVNY84QfkvRFIPw60lqYbit5DRoVWvp0afzUPM2LphSl0Sx5NNlbhvTdmEqjeQyS//Rp oG3qLpRvDr5ZSC8C9uGgNyY741u6QgDibOmJMY/dBCjAhOgF62QYgGIR4QIIDaxn1I4tm Dsec3SWTnSyojYhaHp6L8gMLclaX8v4ZjlvXW556pQDg8LgLiLJR1xD1yJiT+oKJTjg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=LjVCvNBF; arc=none smtp.remote-ip=95.215.58.250 Received: from mta1.migadu.com (out-250.mta1.migadu.com [95.215.58.250]) (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 6967A606A337 for ; Fri, 4 Dec 2026 10:44:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6967A606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=LjVCvNBF X-Envelope-To: netdev@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=XmibhsJ5eRIur4Fe7XkSxlzESxNypPrZxcciZrywkrc=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796381084; v=1; x=1796985884; b=LjVCvNBF6NWJivWbOUxfdjAn/fNaCUPymvdRogxoK50cfNQX0X3g6mV0szQV6Nb/Onxzwvy4 V6UlEhuk74QDtH49i/ZFzpxFjdvCfnaO+uM4INPUoYsO6q822saqHDaa0bBs/frsY5RAEEkzhYR QtTAkZVolAJYcbaoQJmAjWiA= X-Envelope-To: netdev@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id ce6cd0ba159a5f60; Fri, 04 Dec 2026 10:44:44 +0000 X-Mizu-Trace-ID: ce6cd0ba159a5f60 X-Migadu-Flow: FLOW_OUT From: Jiayuan Chen To: netdev@vger.kernel.org Cc: Jiayuan Chen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Neal Cardwell , Kuniyuki Iwashima Subject: [PATCH net v2] tcp: rstreason: introduce SK_RST_REASON_TCP_LISTEN_OVERFLOW Date: Fri, 4 Dec 2026 18:44:35 +0800 Message-ID: <20261204104437.47753-1-jiayuan.chen@linux.dev> X-Mailer: git-send-email 2.43.0 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 Content-Transfer-Encoding: 8bit In tcp_check_req(), the RST sent when the child socket can not be created (e.g. the accept queue is full) and the RST sent for a SYN in window both use SK_RST_REASON_INVALID_SYN, so the tcp_send_reset tracepoint can not tell them apart. Add SK_RST_REASON_TCP_LISTEN_OVERFLOW for the former. It is only sent when net.ipv4.tcp_abort_on_overflow is set. Signed-off-by: Jiayuan Chen --- v1 -> v2 : resend after net tree is merged. v1: https://lore.kernel.org/netdev/axFM0APnT45iKmR9@google.com/ --- include/net/rstreason.h | 7 +++++++ net/ipv4/tcp_minisocks.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index 979ac87b5d994..39537af1d0524 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -23,6 +23,7 @@ FN(TCP_STATE) \ FN(TCP_KEEPALIVE_TIMEOUT) \ FN(TCP_DISCONNECT_WITH_DATA) \ + FN(TCP_LISTEN_OVERFLOW) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -123,6 +124,12 @@ enum sk_rst_reason { * disconnecting, so we have to send an RST. */ SK_RST_REASON_TCP_DISCONNECT_WITH_DATA, + /** + * @SK_RST_REASON_TCP_LISTEN_OVERFLOW: child socket could not be + * created, e.g. accept queue is full. Only sent when + * net.ipv4.tcp_abort_on_overflow is set. + */ + SK_RST_REASON_TCP_LISTEN_OVERFLOW, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 934012cdac276..f15068b615f9a 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -689,6 +689,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, bool fastopen, bool *req_stolen, enum skb_drop_reason *drop_reason) { + enum sk_rst_reason rst_reason = SK_RST_REASON_INVALID_SYN; struct tcp_options_received tmp_opt; struct sock *child; const struct tcphdr *th = tcp_hdr(skb); @@ -960,6 +961,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, inet_rsk(req)->acked = 1; return NULL; } + rst_reason = SK_RST_REASON_TCP_LISTEN_OVERFLOW; embryonic_reset: if (!fastopen) { @@ -975,7 +977,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, * avoid becoming vulnerable to outside attack aiming at * resetting legit local connections. */ - req->rsk_ops->send_reset(sk, skb, SK_RST_REASON_INVALID_SYN); + req->rsk_ops->send_reset(sk, skb, rst_reason); } else if (fastopen) { /* received a valid RST pkt */ reqsk_fastopen_remove(sk, req, true); tcp_reset(sk, skb); -- 2.43.0