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: <20080515055011.GA12809@martell.zuzino.mipt.ru>
Date:	Thu, 15 May 2008 09:50:11 +0400
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Franck Bui-Huu <vagabon.xyz@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	paulmck@...ux.vnet.ibm.com, Josh Triplett <josh@...nel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] rculist.h: use the rcu API

On Wed, May 14, 2008 at 11:26:18PM +0200, Franck Bui-Huu wrote:
> This patch makes almost all list mutation primitives use
> rcu_assign_pointer().
>
> The main point of this being readability improvement.

Which is not an improvement at all.

> --- a/include/linux/rculist.h
> +++ b/include/linux/rculist.h
> @@ -17,9 +18,8 @@ static inline void __list_add_rcu(struct list_head *new,
> {
> 	new->next = next;
> 	new->prev = prev;
> -	smp_wmb();
> +	rcu_assign_pointer(prev->next, new);
> 	next->prev = new;
> -	prev->next = new;
> }

Nice chunk to demonstrate.

Before one could write this like:

	smp_wmb();			smp_wmb();
	next->prev = new;	or	prev->next = new;
	prev->next = new;		next->prev = new;

And both examples aren't buggy.

After, you can't write:

	next->prev = new;
	rcu_assign_pointer(prev->next, new);

Guess why?

This barrier is related not only to next assignment, but to the whole
group of assignments.

> @@ -108,9 +108,8 @@ static inline void list_replace_rcu(struct list_head 
> *old,
> {
> 	new->next = old->next;
> 	new->prev = old->prev;
> -	smp_wmb();
> +	rcu_assign_pointer(new->prev->next, new);
> 	new->next->prev = new;
> -	new->prev->next = new;
> 	old->prev = LIST_POISON2;
> }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ