lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220715163802.6f49d03d@kernel.org>
Date:   Fri, 15 Jul 2022 16:38:02 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Tariq Toukan <tariqt@...dia.com>
Cc:     Boris Pismenny <borisp@...dia.com>,
        John Fastabend <john.fastabend@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>, <netdev@...r.kernel.org>,
        Saeed Mahameed <saeedm@...dia.com>,
        Gal Pressman <gal@...dia.com>,
        Maxim Mikityanskiy <maximmi@...dia.com>
Subject: Re: [PATCH net] net/tls: Fix race in TLS device down flow

On Fri, 15 Jul 2022 11:42:16 +0300 Tariq Toukan wrote:
> Socket destruction flow and tls_device_down function sync against each
> other using tls_device_lock and the context refcount, to guarantee the
> device resources are freed via tls_dev_del() by the end of
> tls_device_down.
> 
> In the following unfortunate flow, this won't happen:
> - refcount is decreased to zero in tls_device_sk_destruct.
> - tls_device_down starts, skips the context as refcount is zero, going
>   all the way until it flushes the gc work, and returns without freeing
>   the device resources.
> - only then, tls_device_queue_ctx_destruction is called, queues the gc
>   work and frees the context's device resources.
> 
> Solve it by decreasing the refcount in the socket's destruction flow
> under the tls_device_lock, for perfect synchronization.  This does not
> slow down the common likely destructor flow, in which both the refcount
> is decreased and the spinlock is acquired, anyway.
> 
> Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
> Reviewed-by: Maxim Mikityanskiy <maximmi@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>

Oh, so it was already racy? Sad this has missed the PR, another delay 
for your -next patches :S

Reviewed-by: Jakub Kicinski <kuba@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ