netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	andrew+netdev@lunn.ch, horms@kernel.org, borisp@nvidia.com,
	john.fastabend@gmail.com, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, sd@queasysnail.net,
	will@willsroot.io, savy@syst3mfailure.io
Subject: Re: [PATCH net v2 1/2] tls: handle data disappearing from under the TLS ULP
Date: Tue, 12 Aug 2025 18:23:59 +0200	[thread overview]
Message-ID: <50a1e8ea-986c-41f2-899c-746098b6b1b7@redhat.com> (raw)
In-Reply-To: <20250812062825.391c030c@kernel.org>

On 8/12/25 3:28 PM, Jakub Kicinski wrote:
> On Tue, 12 Aug 2025 12:45:56 +0200 Paolo Abeni wrote:
>> On 8/8/25 1:29 AM, Jakub Kicinski wrote:
>>> diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
>>> index 549d1ea01a72..51c98a007dda 100644
>>> --- a/net/tls/tls_sw.c
>>> +++ b/net/tls/tls_sw.c
>>> @@ -1384,7 +1384,8 @@ tls_rx_rec_wait(struct sock *sk, struct sk_psock *psock, bool nonblock,
>>>  			return sock_intr_errno(timeo);
>>>  	}
>>>  
>>> -	tls_strp_msg_load(&ctx->strp, released);
>>> +	if (unlikely(!tls_strp_msg_load(&ctx->strp, released)))
>>> +		return tls_rx_rec_wait(sk, psock, nonblock, false);  
>>
>> I'm probably missing something relevant, but I don't see anything
>> preventing the above recursion from going very deep and cause stack
>> overflow.
>>
>> Perhaps something alike:
>>
>> 		released = false;
>> 		goto <function start>
>>
>> would be safer?
> 
> It's a tail call to the same function, the compiler should do that for
> us automatically. Can we not trust the compiler to be sensible? Both
> clang and gcc get it right.

Sound reasonable, I dumbly did not consider it. I'm fine with the patch
in the current form.

/P


  reply	other threads:[~2025-08-12 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 23:29 [PATCH net v2 1/2] tls: handle data disappearing from under the TLS ULP Jakub Kicinski
2025-08-07 23:29 ` [PATCH net v2 2/2] selftests: tls: test TCP stealing data from under the TLS socket Jakub Kicinski
2025-08-08 14:29   ` Eric Dumazet
2025-08-08 14:19 ` [PATCH net v2 1/2] tls: handle data disappearing from under the TLS ULP Eric Dumazet
2025-08-12 10:45 ` Paolo Abeni
2025-08-12 13:28   ` Jakub Kicinski
2025-08-12 16:23     ` Paolo Abeni [this message]
2025-08-13  3:01 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50a1e8ea-986c-41f2-899c-746098b6b1b7@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=savy@syst3mfailure.io \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    --cc=will@willsroot.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).