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: <962bb2b940e64e7da7b71d11b307defc@AcuMS.aculab.com>
Date: Fri, 21 Jul 2023 15:59:38 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Joel Fernandes' <joel@...lfernandes.org>, Alan Huang
	<mmpgouride@...il.com>
CC: Eric Dumazet <edumazet@...gle.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "rcu@...r.kernel.org" <rcu@...r.kernel.org>, "Paul
 E. McKenney" <paulmck@...nel.org>, "roman.gushchin@...ux.dev"
	<roman.gushchin@...ux.dev>
Subject: RE: Question about the barrier() in hlist_nulls_for_each_entry_rcu()

....
> Right, it shouldn't need to cache. To Eric's point it might be risky to remove
> the barrier() and someone needs to explain that issue first (or IMO there needs
> to be another tangible reason like performance etc). Anyway, FWIW I wrote a
> simple program and I am not seeing the head->first cached with the pattern you
> shared above:
> 
> #include <stdlib.h>
> 
> #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
> #define barrier() __asm__ __volatile__("": : :"memory")
> 
> typedef struct list_head {
>      int first;
>      struct list_head *next;
> } list_head;
> 
> int main() {
>      list_head *head = (list_head *)malloc(sizeof(list_head));
>      head->first = 1;
>      head->next = 0;
> 
>      READ_ONCE(head->first);
>      barrier();
>      READ_ONCE(head->first);
> 
>      free(head);
>      return 0;
> }

You probably need to try harder to generate the error.
It probably has something to do code surrounding the
sk_nulls_for_each_rcu() in the ca065d0c^ version of udp.c.

That patch removes the retry loop - and probably breaks udp receive.
The issue is that sockets can be moved between the 'hash2' chains
(eg by connect()) without being freed.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ