From: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
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 06:28:25 -0700 [thread overview]
Message-ID: <20250812062825.391c030c@kernel.org> (raw)
In-Reply-To: <b3a83032-8ed4-4d5d-9df9-6dbd02acac1c@redhat.com>
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.
next prev parent reply other threads:[~2025-08-12 13:28 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 [this message]
2025-08-12 16:23 ` Paolo Abeni
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=20250812062825.391c030c@kernel.org \
--to=kuba@kernel.org \
--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=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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).