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: <20210129215400.500b63ca@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Fri, 29 Jan 2021 21:54:00 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc:     netdev@...r.kernel.org, Geliang Tang <geliangtang@...il.com>,
        davem@...emloft.net, mptcp@...ts.01.org
Subject: Re: [PATCH net-next 01/16] mptcp: use WRITE_ONCE/READ_ONCE for the
 pernet *_max

On Thu, 28 Jan 2021 17:11:00 -0800 Mat Martineau wrote:
> +	if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
> +		addr_max = READ_ONCE(pernet->add_addr_signal_max);
> +		WRITE_ONCE(pernet->add_addr_signal_max, addr_max + 1);
> +	}

This is an odd construct.

READ_ONCE() is used when the value can change underneath the reader,
not in writers. If we want to increment a variable, there must either
be a writer side lock, or the variable has to be switched to atomic_t.

I'm guessing the former is the case here, so there can be no concurrent
writers. Please omit the READ_ONCE():

	if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)
		WRITE_ONCE(pernet->add_addr_signal_max, 
			   pernet->add_addr_signal_max + 1);


Same for other 3 cases.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ