[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <976e0bb7-1846-94cc-0be7-9a9e62563130@chelsio.com>
Date: Thu, 5 Nov 2020 23:20:13 +0530
From: Vinay Kumar Yadav <vinay.yadav@...lsio.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, borisp@...dia.com,
secdev@...lsio.com
Subject: Re: [PATCH net] net/tls: Fix kernel panic when socket is in TLS ULP
On 11/5/2020 6:46 AM, Jakub Kicinski wrote:
> On Tue, 3 Nov 2020 16:17:03 +0530 Vinay Kumar Yadav wrote:
>> user can initialize tls ulp using setsockopt call on socket
>> before listen() in case of tls-toe (TLS_HW_RECORD) and same
>> setsockopt call on connected socket in case of kernel tls (TLS_SW).
>> In presence of tls-toe devices, TLS ulp is initialized, tls context
>> is allocated per listen socket and socket is listening at adapter
>> as well as kernel tcp stack. now consider the scenario, connections
>> are established in kernel stack.
>> on every connection close which is established in kernel stack,
>> it clears tls context which is created on listen socket causing
>> kernel panic.
>> Addressed the issue by setting child socket to base (non TLS ULP)
>> when tls ulp is initialized on parent socket (listen socket).
>>
>> Fixes: 76f7164d02d4 ("net/tls: free ctx in sock destruct")
>> Signed-off-by: Vinay Kumar Yadav <vinay.yadav@...lsio.com>
>
> We should prevent from the socket getting into LISTEN state in the
> first place. Can we make a copy of proto_ops (like tls_sw_proto_ops)
> and set listen to sock_no_listen?
>
Once tls-toe (TLS_HW_RECORD) is configured on a socket, listen() call
from user on same socket will create hash at two places.
tls_toe_hash() ---> ctx->sk_proto->hash(sk); dev->hash(dev, sk);
when connection establishes, same sock is cloned in case of both
(connection in adapter or kernel stack).
Please suggest if we can handle it other way?
Powered by blists - more mailing lists