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: <4a49be4bb85f99de60cfec4c57bce5f1a356416f.camel@nvidia.com>
Date:   Tue, 2 Aug 2022 12:07:18 +0000
From:   Maxim Mikityanskiy <maximmi@...dia.com>
To:     "kuba@...nel.org" <kuba@...nel.org>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        Tariq Toukan <tariqt@...dia.com>,
        Gal Pressman <gal@...dia.com>,
        "john.fastabend@...il.com" <john.fastabend@...il.com>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        Saeed Mahameed <saeedm@...dia.com>,
        Boris Pismenny <borisp@...dia.com>
Subject: Re: [PATCH net-next] net/tls: Use RCU API to access tls_ctx->netdev

On Mon, 2022-08-01 at 12:44 -0700, Jakub Kicinski wrote:
> On Mon, 1 Aug 2022 11:00:53 +0300 Maxim Mikityanskiy wrote:
> > Currently, tls_device_down synchronizes with tls_device_resync_rx using
> > RCU, however, the pointer to netdev is stored using WRITE_ONCE and
> > loaded using READ_ONCE.
> > 
> > Although such approach is technically correct (rcu_dereference is
> > essentially a READ_ONCE, and rcu_assign_pointer uses WRITE_ONCE to store
> > NULL), using special RCU helpers for pointers is more valid, as it
> > includes additional checks and might change the implementation
> > transparently to the callers.
> > 
> > Mark the netdev pointer as __rcu and use the correct RCU helpers to
> > access it. For non-concurrent access pass the right conditions that
> > guarantee safe access (locks taken, refcount value). Also use the
> > correct helper in mlx5e, where even READ_ONCE was missing.
> 
> Oops, looks like we also got some new sparse warnings from this:
> 
> 2 new warnings in drivers/net/bonding/bond_main.c
> 1 new warning  in drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

Looks like neither me, nor our internal CI built these files - sorry!
I'll fix these and look for the usages more carefully.

BTW, the bonding case misses even the READ_ONCE, so it's an existing
bug, exposed by the transition to the proper RCU API in my patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ