From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FBC03E9F6F for ; Tue, 24 Mar 2026 16:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774369096; cv=none; b=rECfo2/tBxv3xZ4yJDIVg5GGqXNCAeQVD6Y0M5mOGpPCzERv36tguxQS9Prt56BNe5WAbBgQWN8+15ZlE0ZvMo8itYL2p5gCZ3J5rsDn4r2p+p2rd1ZZoeI6TBtddDXtRcow/d0gECCybCd+e2wjKHPnCmMzlId5nYNaXWiDvm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774369096; c=relaxed/simple; bh=8C/DjBp39jYkBAqNxvGamQZqh1deDXx2p5oGCfa56L0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IY1jKE50yrCiGdxh2+aw5X2p0DCQ4Y1YZPLY0z9glRkb92hV+2DsFXU6CpiAXtqtflc2PH6ov9MbKsHv2wqbbxdx1XPxUiyjtWATKD+elI3V43PmtBH2Tp0yzdVoak2nvlaFmtLDM0XdckgS2h/Nv7ZGuRXcdy+Hk0x/t11fgZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=D4/fbmV/; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hNWNiVrH; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="D4/fbmV/"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hNWNiVrH" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id AA425EC01C6; Tue, 24 Mar 2026 12:18:13 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Tue, 24 Mar 2026 12:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1774369093; x= 1774455493; bh=Vp4gyJHp4EnpMatG4byhKohMN8YYHeEtYBPYsAxo4N4=; b=D 4/fbmV/2xaEQUi2GFrkcykd0K4l/Mq8czbEjPZOUtDfwY/faC12L3jFJHMENhLX0 NwXN9oy61rAj2P3TubRxJ/Sk6qArVuxTQ+KEn+bjDoNqNTf8zefiK7TKEz9ndWu5 u7c8XEclgs78QZfYDiUMM+B5vPTrofvxBsycsv/8GQ80zZ+TDkdJYbgmXN89BdWg 9prAQQVJH1j4UP5B546+loyB+J4uZFY9SJiCtWKUH/Z9pKfk8nL63cGJgpGSp4Gj so1Ga9DLq3JS8K3zjznlTRsgIc25xHUz2+/qPkhbQWSv3s+tGk86t4F4mg4o3jqM peVzpDGTb3DYNCQ6zlGuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1774369093; x=1774455493; bh=Vp4gyJHp4EnpMatG4byhKohMN8YYHeEtYBP YsAxo4N4=; b=hNWNiVrHJn9+ORahaDBKAiSeensm0b4SHVRuH6try9r1XoAMPjp g2L4nn1rJt8u5GvOet8YuiEJ576gzeUbfDcuIZpTW95yP3h8z/VZm6Vq2DeMc5pH 85CT1xFso1XUgzcsGzkBjhe/WCXJ8MJnSOzL4s4+4odFE79DV5TtLz5toql+S9kL 9x0xT+3IZj52uQsJ325trofpQlH31qfcQL8/iOLY/s1EzKHgXLv7tNOU8rGmo5wv YTW+pLnuB/tpT88HPM3Xaag01NDmkij3owL3h/xgTVC/AqcHuH3Ukzaxt/mWfFYJ G+qSEbmVdvFkcn3mnJopNtlbz8qGW6jFBGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefvddvtdegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtjeenucfhrhhomhepufgrsghrihhn rgcuffhusghrohgtrgcuoehsugesqhhuvggrshihshhnrghilhdrnhgvtheqnecuggftrf grthhtvghrnhepuefhhfffgfffhfefueeiudegtdefhfekgeetheegheeifffguedvueff fefgudffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgusehquhgvrghshihsnhgrihhlrdhnvghtpdhnsggprhgtphhtthhopeejpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopegtvghlsehkvghrnhgvlhdrohhrghdprhgtph htthhopehjohhhnhdrfhgrshhtrggsvghnugesghhmrghilhdrtghomhdprhgtphhtthho pehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepnhgvthguvghvsehvghgvrh drkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepkhgvrhhnvghlqdhtlhhsqdhhrghnughs hhgrkhgvsehlihhsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtoheptghhuhgtkhdrlh gvvhgvrhesohhrrggtlhgvrdgtohhmpdhrtghpthhtohephhgrrhgvsehsuhhsvgdruggv X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Mar 2026 12:18:12 -0400 (EDT) Date: Tue, 24 Mar 2026 17:18:10 +0100 From: Sabrina Dubroca To: Chuck Lever Cc: john.fastabend@gmail.com, kuba@kernel.org, netdev@vger.kernel.org, kernel-tls-handshake@lists.linux.dev, Chuck Lever , Hannes Reinecke Subject: Re: [PATCH net-next v5 6/6] tls: Flush backlog before waiting for a new record Message-ID: References: <20260324-tls-read-sock-v5-0-5408befe5774@oracle.com> <20260324-tls-read-sock-v5-6-5408befe5774@oracle.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260324-tls-read-sock-v5-6-5408befe5774@oracle.com> 2026-03-24, 08:53:28 -0400, Chuck Lever wrote: > From: Chuck Lever > > While lock_sock is held, incoming TCP segments land on > sk->sk_backlog rather than sk->sk_receive_queue. > tls_rx_rec_wait() inspects only sk_receive_queue, so > backlog data remains invisible. For non-blocking callers > (read_sock, and recvmsg or splice_read with MSG_DONTWAIT) > this causes a spurious -EAGAIN. For blocking callers it > forces an unnecessary sleep/wakeup cycle. > > Flush the backlog inside tls_rx_rec_wait() before checking > sk_receive_queue so the strparser can parse newly-arrived > segments immediately. > > Fixes: 20ffc7adf53a ("net/tls: missing received data after fast remote close") How did you pick that Fixes tag? That commit mentions FIN/connection closing, which doesn't seem related to the local backlog. And it's quite possible there was a similar problem when kTLS was using the generic strparser, but the code has changed so much with 84c61fe1a75b ("tls: rx: do not use the standard strparser") and the work around that, that blaming something older probably doesn't make too much sense. > Suggested-by: Sabrina Dubroca > Reviewed-by: Hannes Reinecke > Signed-off-by: Chuck Lever > --- > net/tls/tls_sw.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c > index 8fb2f2a93846..84c4ae0330d1 100644 > --- a/net/tls/tls_sw.c > +++ b/net/tls/tls_sw.c > @@ -1372,6 +1372,7 @@ tls_rx_rec_wait(struct sock *sk, struct sk_psock *psock, bool nonblock, > if (ret < 0) > return ret; > > + sk_flush_backlog(sk); Do we need to update released when this returns true, like callers of tls_read_flush_backlog() do? I also wonder if we'd want to update the caller's flushed_at to avoid bypassing the "smart checks" in tls_read_flush_backlog(). > if (!skb_queue_empty(&sk->sk_receive_queue)) { > /* Defer notification to the exit point; > * this thread will consume the record -- Sabrina