From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934179AbcI2PyP (ORCPT ); Thu, 29 Sep 2016 11:54:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60253 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932366AbcI2PyG (ORCPT ); Thu, 29 Sep 2016 11:54:06 -0400 Date: Thu, 29 Sep 2016 08:54:01 -0700 From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@kernel.org, dhowells@redhat.com, will.deacon@arm.com, peterz@infradead.org, stern@rowland.harvard.edu Subject: [PATCH locking/Documentation 1/2] Add note of release-acquire store vulnerability Reply-To: paulmck@linux.vnet.ibm.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092915-0016-0000-0000-000004CE7F6E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005825; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00762743; UDB=6.00363581; IPR=6.00537870; BA=6.00004771; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012820; XFM=3.00000011; UTC=2016-09-29 15:54:02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092915-0017-0000-0000-0000335EC26F Message-Id: <20160929155401.GA5097@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-29_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609290278 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This commit therefore updates the documentation to call this vulnerability out explicitly. Reported-by: Alan Stern Signed-off-by: Paul E. McKenney --- Documentation/memory-barriers.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index ba818ecce6f9..a57679ec9441 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -490,14 +490,18 @@ And a couple of implicit varieties: the subsection "MMIO write barrier"). In addition, a RELEASE+ACQUIRE pair is -not- guaranteed to act as a full memory barrier. However, after an ACQUIRE on a given variable, all memory accesses preceding any prior - RELEASE on that same variable are guaranteed to be visible. In other - words, within a given variable's critical section, all accesses of all - previous critical sections for that variable are guaranteed to have - completed. + RELEASE on that same variable in that same chain of RELEASE+ACQUIRE + pairs are guaranteed to be visible. In other words, within a given + variable's critical section, all accesses of all previous critical + sections for that variable are guaranteed to have completed. This means that ACQUIRE acts as a minimal "acquire" operation and RELEASE acts as a minimal "release" operation. + However, please note that a chain of RELEASE+ACQUIRE pairs may be + broken by a store by another thread that overwrites the RELEASE + operation's store before the ACQUIRE operation's read. + A subset of the atomic operations described in atomic_ops.txt have ACQUIRE and RELEASE variants in addition to fully-ordered and relaxed (no barrier semantics) definitions. For compound atomics performing both a load and a -- 2.5.2