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] [day] [month] [year] [list]
Message-ID: <573cb5d3-ebef-40c9-9f21-b75fcbe9514a@gmail.com>
Date: Sat, 18 Jan 2025 03:09:36 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Mina Almasry <almasrymina@...gle.com>, David Wei <dw@...idwei.uk>,
 io-uring@...r.kernel.org, netdev@...r.kernel.org,
 Jens Axboe <axboe@...nel.dk>, Paolo Abeni <pabeni@...hat.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jesper Dangaard Brouer <hawk@...nel.org>, David Ahern <dsahern@...nel.org>,
 Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
 Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v11 10/21] net: add helpers for setting a memory
 provider on an rx queue

On 1/18/25 02:08, Jakub Kicinski wrote:
> On Fri, 17 Jan 2025 23:20:58 +0000 Pavel Begunkov wrote:
>>> True, so not twice, but the race is there. It's not correct to call
>>> ops of a device which has already been unregistered.
>>
>> Ok, from what you're saying it's regardless of the netdev still
>> having refs lingering. In this case it was better a version ago
>> where io_uring was just taking the rtnl lock, which protects
>> against concurrent unregistration while io_uring is checking
>> netdev.
> 
> Yes, v9 didn't have this race, it just didn't release the netdev ref
> correctly. Plus we plan to lift the rtnl_lock requirement on this API
> in 6.14, so the locking details best live under net/
> 
> The change I suggested to earlier should be fine.
> 
>   - If uninstall path wins it will clear and put the netdev under the
>     spin lock and the close path will do nothing.
> 
>   - If the close path grabs the netdev pointer the uninstall path will
>     do nothing in io_uring, just clear the pointers in net/ side. Then
>     the close path will grab the lock in net_mp_open_rxq() see the netdev
>     as unregistered, return early, put the ref.
> 
> Did I miss something?

That should work, but it's also a house of cards comparing to the
alternative, that netdev trickery with bunch of sync around is a
direct product of that. It absolutely will fail at some point.

I'll put it in, I don't care anymore.

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ