Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2040532pxk; Sat, 3 Oct 2020 06:25:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgEvxL8To/cpgQkoJ0dK3nEnaT5FWkrsdy21f6sPgYUiEEM4qsEjlzjDoVir8LEu1Wr86z X-Received: by 2002:a17:906:c55:: with SMTP id t21mr6785356ejf.276.1601731527067; Sat, 03 Oct 2020 06:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601731527; cv=none; d=google.com; s=arc-20160816; b=yhLjAVtd+HnDsEkqihBNwCtdEMBSALnVzO9I7AGEwzThUU5Ji4cVPno3EBADLt4A92 S/DTPsIUZEmZCCUUrKe0p3sQGEN4HjZgtkQ5Hd6Dyrxak51kakHZrKsClFh1KaQApDxW TZ+luFvMeEk1pX/PmBU8PSMpw6elphbh/XALKjeIO2IYEx5Mr5n3GU4zQuZA4GFZo4D9 5o9rCdiNh3VBo4ABVi/F3eaY/uhfVDM/EcF2BTOirqH1Vm02VmcJf/95S7kmsvZ32j2r Bi4CoPOWOcy8L/0IKKe2IxIjP4Syt/RCBYILhItHt3Su27Pg21FDecaH/OHNYSKEhMTW wyHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=YSv1IBxszHpZiVMPBj/u8Oido/1la/fWaBwnQKVUmNQ=; b=dSTbz984CMEnqAdS82bYlfNUObb7hnYtzRihTK5qKrLhLzSkE6yrFnXpENuenDoYjm /udSR5u0I00ypFzNrPztoQvZqwKvx95vzlQujS+5GdH0LDRz/D05p4nrpPMgmS/eXeUa gH44n5D4WYQbejVI8vZYGkYwBRH7QrlmZXATaEvZwA/hbNIdro13Yjf2vNE56U8gae40 uVTSaX/PtgXe2nmmmBIPJK7HRP5y9cZL9cjBXd0utVgrLC2LgcwsWlQLgCxiwswXmSI4 C9X/yjBGd6euS5t2/SnI092qH8beVXUwv/KKKZD2HGRrZtZ2vaXjgiurK1C7BI1ONT9z v2Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g31si3368918edd.381.2020.10.03.06.25.04; Sat, 03 Oct 2020 06:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725790AbgJCNWO (ORCPT + 99 others); Sat, 3 Oct 2020 09:22:14 -0400 Received: from netrider.rowland.org ([192.131.102.5]:48481 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725710AbgJCNWN (ORCPT ); Sat, 3 Oct 2020 09:22:13 -0400 Received: (qmail 319931 invoked by uid 1000); 3 Oct 2020 09:22:12 -0400 Date: Sat, 3 Oct 2020 09:22:12 -0400 From: Alan Stern To: "Paul E. McKenney" Cc: parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: Litmus test for question from Al Viro Message-ID: <20201003132212.GB318272@rowland.harvard.edu> References: <20201001045116.GA5014@paulmck-ThinkPad-P72> <20201001161529.GA251468@rowland.harvard.edu> <20201001213048.GF29330@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201001213048.GF29330@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To expand on my statement about the LKMM's weakness regarding control constructs, here is a litmus test to illustrate the issue. You might want to add this to one of the archives. Alan C crypto-control-data (* * LB plus crypto-control-data plus data * * Expected result: allowed * * This is an example of OOTA and we would like it to be forbidden. * The WRITE_ONCE in P0 is both data-dependent and (at the hardware level) * control-dependent on the preceding READ_ONCE. But the dependencies are * hidden by the form of the conditional control construct, hence the * name "crypto-control-data". The memory model doesn't recognize them. *) {} P0(int *x, int *y) { int r1; r1 = 1; if (READ_ONCE(*x) == 0) r1 = 0; WRITE_ONCE(*y, r1); } P1(int *x, int *y) { WRITE_ONCE(*x, READ_ONCE(*y)); } exists (0:r1=1)