From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752535AbcI3KZ1 (ORCPT ); Fri, 30 Sep 2016 06:25:27 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:36746 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbcI3KZU (ORCPT ); Fri, 30 Sep 2016 06:25:20 -0400 Date: Fri, 30 Sep 2016 12:25:16 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Will Deacon , linux-kernel@vger.kernel.org, mingo@kernel.org, dhowells@redhat.com, stern@rowland.harvard.edu Subject: Re: [PATCH locking/Documentation 1/2] Add note of release-acquire store vulnerability Message-ID: <20160930102516.GW5012@twins.programming.kicks-ass.net> References: <20160929155401.GA5097@linux.vnet.ibm.com> <20160929155817.GB5016@twins.programming.kicks-ass.net> <20160929160307.GT13862@arm.com> <20160929164353.GX14933@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160929164353.GX14933@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2016 at 09:43:53AM -0700, Paul E. McKenney wrote: > If two processes are related by a RELEASE+ACQUIRE pair, ordering can be > broken if a third process overwrites the value written by the RELEASE > operation before the ACQUIRE operation has a chance of reading it, for > example: > > P0(int *x, int *y) > { > WRITE_ONCE(*x, 1); > smp_store_release(y, 1); > } > > P1(int *y) > { > smp_store_release(y, 2); > } > > P2(int *x, int *y) > { > r1 = smp_load_acquire(y); > r2 = READ_ONCE(*x); > } > > Both ARM and powerpc allow the "after the dust settles" outcome (r1=2 && > r2=0), as does the current version of the early prototype Linux-kernel > memory model. > > This commit therefore updates the documentation to call this vulnerability > out explicitly. So its a pretty dumb thing to do in any case (and yes the kernel does this). Its also entirely expected in my book, that if you generate conflicting writes on a release, ordering is out the window. Why do we need to call this out? Who in his right mind would want to do this and expect anything other than wreckage? Not that we're not having too much 'fun' discussing this,.. but I do wonder why we need to call this out.