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
| ||
|
Message-ID: <CANn89iJxdOGcjbrLwP4ryEB=c74=0A8vdOFowv98f6n6tuuztg@mail.gmail.com> Date: Wed, 29 Nov 2023 22:06:21 +0100 From: Eric Dumazet <edumazet@...gle.com> To: David Laight <David.Laight@...lab.com> Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>, Stephen Hemminger <stephen@...workplumber.org>, David Ahern <dsahern@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "jakub@...udflare.com" <jakub@...udflare.com> Subject: Re: [PATCH net-next] ipv4: Use READ/WRITE_ONCE() for IP local_port_range On Wed, Nov 29, 2023 at 8:26 PM David Laight <David.Laight@...lab.com> wrote: > > Commit 227b60f5102cd added a seqlock to ensure that the low and high > port numbers were always updated together. > This is overkill because the two 16bit port numbers can be held in > a u32 and read/written in a single instruction. > > More recently 91d0b78c5177f added support for finer per-socket limits. > The user-supplied value is 'high << 16 | low' but they are held > separately and the socket options protected by the socket lock. > > Use a u32 containing 'high << 16 | low' for both the 'net' and 'sk' > fields and use READ_ONCE()/WRITE_ONCE() to ensure both values are > always updated together. > > Change (the now trival) inet_get_local_port_range() to a static inline > to optimise the calling code. > (In particular avoiding returning integers by reference.) > > Signed-off-by: David Laight <david.laight@...lab.com> Nice, I had this patch on my TODO list :)
Powered by blists - more mailing lists