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]
Date: Mon, 3 Jun 2024 11:21:47 +0200
From: Petr Machata <petrm@...dia.com>
To: Nikolay Aleksandrov <razor@...ckwall.org>
CC: Petr Machata <petrm@...dia.com>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, "Paolo
 Abeni" <pabeni@...hat.com>, <netdev@...r.kernel.org>, Ido Schimmel
	<idosch@...dia.com>, David Ahern <dsahern@...nel.org>
Subject: Re: [PATCH net-next 0/4] Allow configuration of multipath hash seed


Nikolay Aleksandrov <razor@...ckwall.org> writes:

> On 5/30/24 21:07, Nikolay Aleksandrov wrote:
>> On 5/30/24 20:27, Nikolay Aleksandrov wrote:
>>> On 5/30/24 18:25, Petr Machata wrote:
>>>>
>>>> I kept the RCU stuff in because it makes it easy to precompute the
>>>> siphash key while allowing readers to access it lock-free. I could
>>>> inline it and guard with a seqlock instead, but that's a bit messier
>>>> code-wise. Or indeed construct in-situ, it's an atomic access plus like
>>>> four instructions or something like that.
>>>
>>> You can READ/WRITE_ONCE() the full 8 bytes every time so it's lock-free
>>> and consistent view of both values for observers. For fast-path it'll
>>> only be accessing one of the two values, so it's fine either way. You
>>> can use barriers to ensure latest value is seen by interested readers,
>>> but for most eventual consistency would be enough.
>> 
>> Actually aren't we interested only in user_seed in the external reader
>> case? We don't care what's in mp_seed, so this is much simpler.
>
> Oh, I misunderstood you, didn't I? :) Were you talking about
> constructing the siphash key in the fast-path above? If yes,
> then sure it's a few instructions but nothing conditional.

That's what I meant. I tried to be concise and went overboard.

> I don't think we need anything atomic in that case.

Hmm, right, no competing increments of any sort, so WRITE_ONCE in the
control path and READ_ONCE in fastpath should be enough.

Thanks for the feedback, I'll send v2 this week.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ