From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94DEB2857F0 for ; Sat, 13 Jun 2026 17:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781371118; cv=none; b=u2heB4oRm+iKVM1y+g4nZda6BHIoIgkOr1DrAgdDFqyzI990PZeDZhI18C5Avb+kEDvNuTC9jSMpuwu3r91Mrgpw65+r3bjtQjLktvK1hPu+qsPk8CJf4zBLKPHzfxDy783AfEDwX3a6SWbaOaOoVBXce4+kNlZVa9bZ0I5FGdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781371118; c=relaxed/simple; bh=Cj5N0eeCmGO5Snsfg7U9jbw3jypnfrAo3YwWsSoyMOY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C41tzzD/32ITo1G0ezxz19/inaFi/+TcJ0dv0gcC7MYs3fjEWyowfJyQulEdNQAc8N3lx8XL2owyf1VJaDNCDfQriejfHnsxX8NrZjgWzvzmavB19NbybZ8ZqVB2Uus1wRXLCZ7Zw5XtMPm3I6ujkGVrrATjbv63TtQJ+sd4m5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ky4Yk4jK; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ky4Yk4jK" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-45ef5146b56so1863605f8f.0 for ; Sat, 13 Jun 2026 10:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781371116; x=1781975916; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=r9WERUh0e5RRWU4hvKVbrVtwoM+Idz3+GqskEiEcWjU=; b=Ky4Yk4jKkAk5XURJrbYmOv7GB0fqJLjySPXF0/njsTkFJSftsY/MTPrHl2r73JlmJq YtYeCLyzu60VmlnB0HwHKiPLllxappq1D4uhNr6Q9roZhMr1q7Mu+9mx8U88E/bK3P6R Gvj+kcldwBYlgy8QOvJxfvflpRR6T4w72/zMlaDSsduHVaFMTqU6L3wOgwaJabsEztYU gbHlifh32fRgnAQM+HWoNpZ+qeh9eBuGviJsfVztKqwGarjtEMsY3NXmgPzEh+WgFcXt hRNuFuVD1MVqrB2Fc4E2KL1k1pbT/rOz/sbiYavl27HudMglJCmT5NXyMCWBfFWRuJB+ 1xaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781371116; x=1781975916; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r9WERUh0e5RRWU4hvKVbrVtwoM+Idz3+GqskEiEcWjU=; b=bnKqByxXjGvcssx0GIHOzRc4NEooVDmwXtKUfDWuM4L1HwKtWOgxU0o6t10qKfUAz2 aqDfUIlSIUnluIMLARs+6xVQtMjYJyJ24YpOVpMLLjXCY/6RIkBbrWC8JBvVoJd1bRUt 7faRNh7S2Oceg9XL3bbQPTiLPuPH9XtaWnjBFXCPK7bA/PDvj/MeyDcu98SelWCcf6T3 kHL4dw4Ax8nWKWO0nU54WgXfPXJMmJ8HBNVrBX33HXWnTWWk3c96rE+MBCkBTLS91RES daROLwx7FURjqaKg26y+e7CkaedzPCSCQ+NZguPSPO/0L4qq2SXe1eMM53mxS+YvOdbz w+bg== X-Forwarded-Encrypted: i=1; AFNElJ+Qbe6y4mhszd/EnGkfqFyh1PZhP3lDzziGcQS4ZUXAXMOO1OS2TNYHzOQsQEWb0eBSH3hPxE2F+m56Se4=@vger.kernel.org X-Gm-Message-State: AOJu0YwHBpeA77qBuaqwgpmYkIjdpbEPkII5F8MwcxNFaFnEd33UVRav 7WmrYc+rBt15ARetUyweh/f3IcWvkGQQzABOjdBPS58A6VvDvnvI4qNy X-Gm-Gg: Acq92OFm6vrZm80Ynwgc2Blu3rwLVIv29XQqkyetGSLUYIWJx7G36OxkilynIS1xHKZ kSBceIVmcGFC42UI41n2SDyKj/AjrN+q0eu3WHvZtkjwmSq3X4okJhT7LZQ1aawEe06BR3793V/ Iasx4H+52sG1EslQ98EJo7n0c4b05ljmImDa9zpbZiTJ+ecBGdCOBwpzqMhQVkVXGoJ50DAHmJq svJ0/uGrdF4cpWyJnztZoTMWI2sr9dWX5qcT7JCtTWaWUN7qsX5eb18uNUVmbwxtpiTrbIjeo1J PhQ+4NetUrUtp/u0NOLa/bdMcPSC0m0j6lFSlU3ZemKqtKwqWkrTIX6kD37OibwT4BvNx88RJ7J B6qIe2B/R7Ov/3ZXnSu/A3UG3Tlhv22QRxDOqfTfX+4MMXygRoe0/9Jt4KqS7E2QmJ/LV4hM3oL NXpOVyEAe9k3yOkUheoSlJrD4UN2V3Dvnwzco75cZsNPOIKFJHDoJOviLHD9MpN9hzQufS7nlfE sWxkwe8MfjpaxA7tw9tU9aD X-Received: by 2002:a05:600c:3145:b0:490:9dc3:3483 with SMTP id 5b1f17b1804b1-490ec480f88mr89427715e9.2.1781371115732; Sat, 13 Jun 2026 10:18:35 -0700 (PDT) Received: from gandalf.schnuecks.de (p200300c14f38df00921b0efffe889e28.dip0.t-ipconnect.de. [2003:c1:4f38:df00:921b:eff:fe88:9e28]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-492202edf89sm96591285e9.1.2026.06.13.10.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2026 10:18:34 -0700 (PDT) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id 6066731BD2D8; Sat, 13 Jun 2026 19:18:34 +0200 (CEST) Date: Sat, 13 Jun 2026 19:18:34 +0200 From: Simon Baatz To: Eric Dumazet Cc: Jakub Kicinski , Simon Baatz via B4 Relay , Neal Cardwell , Kuniyuki Iwashima , "David S. Miller" , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] tcp: tighten the FIN exception in tcp_sequence() Message-ID: References: <20260610-tcp_fin_more_restrictive-v1-1-eefc30d7ddd8@gmail.com> <20260612154355.37bb426d@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Eric, On Fri, Jun 12, 2026 at 08:47:51PM -0700, Eric Dumazet wrote: > On Fri, Jun 12, 2026 at 4:40???PM Simon Baatz wrote: > > > > Hi Jakub, > > > > On Fri, Jun 12, 2026 at 03:43:55PM -0700, Jakub Kicinski wrote: > > > On Wed, 10 Jun 2026 00:09:24 +0200 Simon Baatz via B4 Relay wrote: > > > > From: Simon Baatz > > > > > > > > Commit 1e3bb184e941 ("tcp: re-enable acceptance of FIN packets when > > > > RWIN is 0") added a special case in tcp_sequence() to mirror the FIN > > > > exception in tcp_data_queue(), which accepts bare in-order FINs even > > > > when the advertised window is zero. That behavior is not > > > > RFC-compliant, but was introduced in commit 2bd99aef1b19 ("tcp: accept > > > > bare FIN packets under memory pressure") to break tight FIN/ACK loops > > > > caused by broken clients. > > > > > > > > However, the condition added by commit 1e3bb184e941 ("tcp: re-enable > > > > acceptance of FIN packets when RWIN is 0") is broader than required > > > > and allows other non-compliant packets as well. > > > > > > > > Tighten the tcp_sequence() FIN exception to only allow packets where > > > > the packet is a bare in-order FIN and only the FIN flag extends beyond > > > > tcp_max_receive_window(). In particular, this exception is only > > > > reachable if tcp_max_receive_window() is zero. Otherwise the packet is > > > > already accepted by the normal sequence check. > > > > > > > > The existing packetdrill test tcp_rcv_zero_wnd_fin.pkt exercises this > > > > behavior already and does not need to be changed. > > > > > > > > Signed-off-by: Simon Baatz > > > > > > This is odd. You are sending this patch which shares a lot of > > > similarities with Eric's patch: > > > https://lore.kernel.org/all/20260608151452.706822-1-edumazet@google.com/ > > > > > > Why are you submitting your own patch instead of discussing it further > > > with Eric and letting him send v2? > > > > That's what I understood from Eric's reply to my comments. He asked > > for an alternative, so I sent this as a concrete sugggestion. > > Yes this is fine, please next time includ a link to the 'other patch' > since this discussion > was started by someone :) Hmm, in hindsight this is quite obvious... > About your patch, I thought that it would be fine to allow a remote > peer to add a FIN > to a payload packet of N bytes even if RWIN == N I just realized that RFC 9293 has an "or" in: RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND (SEG.LEN includes SYN/FIN) Linux TCP is stricter here effectively requiring both conditions since commit 9ca48d6 ("tcp: do not accept packets beyond window"). Given that, it's fine to accept packets with an "additional FIN" that fulfill the first condition. > It seems the bug of your other stack is that the FIN can be sent with > no payload, > and this is a less broader case. > > FIN storage (a bit) is there, we can generalize the acceptance of FIN for free ? Agreed. Let's drop this patch and generalize the FIN handling as you suggest. - Simon -- Simon Baatz