[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50a1e8ea-986c-41f2-899c-746098b6b1b7@redhat.com>
Date: Tue, 12 Aug 2025 18:23:59 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
andrew+netdev@...n.ch, horms@...nel.org, borisp@...dia.com,
john.fastabend@...il.com, shuah@...nel.org, linux-kselftest@...r.kernel.org,
sd@...asysnail.net, will@...lsroot.io, savy@...t3mfailure.io
Subject: Re: [PATCH net v2 1/2] tls: handle data disappearing from under the
TLS ULP
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
Powered by blists - more mailing lists