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: <20230724084126.38d55715@kernel.org>
Date: Mon, 24 Jul 2023 08:41:26 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Paolo Abeni <pabeni@...hat.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
 mkubecek@...e.cz, lorenzo@...nel.org, Herbert Xu
 <herbert@...dor.apana.org.au>, Neil Brown <neilb@...e.de>
Subject: Re: [PATCH net-next 1/2] net: store netdevs in an xarray

On Mon, 24 Jul 2023 10:18:04 +0200 Paolo Abeni wrote:
> A possibly dumb question: why using an xarray over a plain list?

We need to drop the lock during the walk. So for a list we'd need 
to either 
 - add explicit iteration "cursor" or 
 - suffer O(n) for insertion + O(n^2) for restart?

Or there's a easier way to do it?
The cursor is not the worst option, I guess, a bit less intuitive
and harder to clean up on error, but doable?

> It looks like the idea is to additionally use xarray for device lookup
> beyond for dumping?

I was measuring it to find out if we can delete the hash table without
anyone noticing, but it's not really the motivation.

> WRT the above, have you considered instead replacing dev_name_head with
> an rhashtable? (and add the mentioned list)

The main motivation is ease of iteration for netlink dumps.

I'll admit that my understanding of rhashtable is superficial but
I don't think it's possible to do consistent dumps with it. Even 
if it supported "cursors" (which I'm not sure it does) a rhash could
rearrange buckets and mess the order up. The comment on
rhltable_walk_enter() says:

 * For a completely stable walk you should construct your own data
 * structure outside the hash table.

Given the iteration process is controlled by user space trying to
constrain a rhash also used by the fast path to get consistent dumps
seems risky.

Adding Herbert and Neil to keep me honest.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ