Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp133989lqr; Wed, 5 Jun 2024 00:57:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWT9YikWo+EkMH8a/q5GWlKtdRPoSCIywtpuORtRCVjGH1OBP/LBnD851uq9O6nGu5do18miPoIiEZ39fZjFYAKzrxJWWRLWxXGgJas4A== X-Google-Smtp-Source: AGHT+IEA7aPCexL6c6Bi//zazoO6qIOggmmbBjegP5F1yW8Gk+UitbiWK7HGUDpi0pazYQxFCjom X-Received: by 2002:a05:6a20:918e:b0:1b0:111f:2b6d with SMTP id adf61e73a8af0-1b2b70ff185mr3261050637.28.1717574248313; Wed, 05 Jun 2024 00:57:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717574248; cv=pass; d=google.com; s=arc-20160816; b=uwfPb8Gv+pAe7cOnULsX7wvzoUpQD1KXzyYoS7MJR4T5BwLnxBx599hF2on5QonNga aPSeZSV1ODDfgAn8ZQP4aVTDAUttkf8Od+qxtZZ6+0dl9burjKIVPVIq6hPAuA9jf1zV eo7Ba1+i0w6TeTwW8GrV7Q3UIJSoM5H/x0LIW63PyEEl7q6wa7PqJULBt8LR5q4kk4JN goZL5hOWlkkQZFrydYOKD9ZuzFpx24p0zLoOMxMBdMPq+hPgKvP4t4kp9/vO7EhnBFzn 0QhCvraGl8IHng8OyTJjVn2CgqASi8Rlr6pt+tHhNi0+vgyLIOShd5enSBENBxGS1RF4 9bHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=K7HNwq80CUl9euhXBEKTrmHO/OrgPhpji/JBSWvl19w=; fh=owZB+lE3GPS15v98Pu3SRGy2y/GpwhaYJp4rkwGHB0E=; b=saaKHu1SZxsVo+IISxy/UCMZ90KVFiOqb+sYB+rh3EakPrNE1sb6IPnFD8Qj9tyrBv zCaNkFyoMXQdyura1pDI/kvsgLdxrH5KA3xbM/deeaiExCmBOQtfAqywjLT2VTubt5Gz COARtOkf0rq4zT/swUYhq5Zv5KtSxSgwIxOigTEV2T01yI6b8fs4IifpxGXUqeXWXthV 2QGkDI5tN0dU5ekuCPgGa2yNgqidPrJwCjV8hbVFjKh84C409WTHsuS8i7hD9Pp/1Rxi 4O57bnVzliRR59hkTWSfSpLxy7KMW7fi7snOE/NA2asKT0tAJpErvPY2NlyzUmmJlH/g WDlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=SzZBjnR+; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201917-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7026b25b8a9si5322791b3a.182.2024.06.05.00.57.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 00:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201917-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=SzZBjnR+; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201917-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DCC84282950 for ; Wed, 5 Jun 2024 07:57:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D644E18F2D5; Wed, 5 Jun 2024 07:57:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SzZBjnR+" Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A76DD18C35C for ; Wed, 5 Jun 2024 07:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717574240; cv=none; b=Ji9HLtKeokVpQzUgMdVmvb4SaBo44QCmvl3Ex+sI8CP8CN0bH9xcSDU2v9lGKJMp9YzAiB8h1syeQ7497RXNgjauc+2jgYVmCpsDUo9jJSmwNAD7Lc38/tQUXK45oiq/r2Iwl2eDv8Q8dcP68gGOwyxb/KAOSlGc1ms8HAICoT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717574240; c=relaxed/simple; bh=MEB3T134sg1+5ITkh0MrNcrAbFTCgwOkdrrL0VU1wg0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Kp9IyHHqiwDTrlJs2uTeTY313nrpAOJeRz5Qtaeec8i2Z4z1058DHPRWVSL/ESu9kcZFGajmA4TjFyYoEIjplRMX+R5lRvJlirYR76K3JNWN76mb7TELY7oW436HfoN9pRPDlXNKXvlTWCS3ZOJ+tp0vCo5zMmpuz0x9uol0INQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=SzZBjnR+; arc=none smtp.client-ip=209.85.221.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-4eb2b6164b7so361956e0c.0 for ; Wed, 05 Jun 2024 00:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717574237; x=1718179037; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=K7HNwq80CUl9euhXBEKTrmHO/OrgPhpji/JBSWvl19w=; b=SzZBjnR+NuSqO+SsDVfRqkgYkJXYxOxQ47+5e9WEJ/+YQdMW8E7i+I3CKcOlK39+E8 mi/TNHxzj0d7xot/NDSHny/qJAlPjz6nZT8hgwvAylNAAX6CcwqDP+intqdGGgsOqSZM a/sxitBS3D4t81z3pL13XfJCiigJscynBq9uY5tYPrgqJTeXfEkLNlfRUesoiEuY8xrU dX2vFLNI+HITy7LmD5jCIganqGV0AuB06UAhkolKAFlq75rrAArIsampWkQ2KkRjejcb sShS5poanwKr1ARuvBfyEpDfFQmZ++oFplJ048m06jSZDdNKkYFeiR25blLTHSkzI2MJ DMUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717574237; x=1718179037; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K7HNwq80CUl9euhXBEKTrmHO/OrgPhpji/JBSWvl19w=; b=CJpB3v37UKXzX+Vcm7xOFNhVx9th/RtJWF+iHftCf1V2dvnQn7fBl0DucvqABPGRiQ kElilDKjjbMhOGqCrgOGMzu2xPl8s9KoIUnp70fD7/3jCL06Pghqq4fDmR5NNjYNIzqt khRjrjTZD+ZZTdDPQhJjt2zwjC+COKSLCkSjCOdP5/U5iNdZXE3ukLtwP99qukSDzEgK uU6EGkv8refwgWYWYxVI9VqaJvEA2XnVxBRCZ2XHWC2aloTQfZRYRRBEsERlJ23DGoGp 1R2MGIaNbi7dmZzpZcpS5qRF1arlIb90TOLLyONXzkPiKCjEwSpVU3h1kzWVX11lKX8K Tu5g== X-Forwarded-Encrypted: i=1; AJvYcCUCMa7MeIw0LHtHjlAgjqxzdqKKVSckO1A7a5OwfcuAzOgGCUNjio/jRvbe+41eDTzyJOP5qLOQmNkn4q4QItV+WHslOJiGu9kNjNmy X-Gm-Message-State: AOJu0YwTuc4EJr+WD9BNxbu7WhdgoavvAXXlKuWjF0xapOokEPjKJcmP 4EksVAPcpyGXxRrSyeRkoYJVk0gQkuekDLWzwoJTlWA8giqZkXybBG+nJArOvezi2jDK7Fuyc4Y Q1r3mSYPZ1vXLTxQNuW5FmEHKiNbqlhkOwuam X-Received: by 2002:a05:6122:a18:b0:4eb:e37:2d19 with SMTP id 71dfb90a1353d-4eb2bc01ecfmr4739547e0c.1.1717574237255; Wed, 05 Jun 2024 00:57:17 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240604223633.2371664-2-paulmck@kernel.org> In-Reply-To: <20240604223633.2371664-2-paulmck@kernel.org> From: Marco Elver Date: Wed, 5 Jun 2024 09:56:41 +0200 Message-ID: Subject: Re: [PATCH rcu 2/4] rcutorture: Fix rcu_torture_fwd_cb_cr() data race To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Andrey Konovalov , kasan-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" On Wed, 5 Jun 2024 at 00:36, Paul E. McKenney wrote: > > On powerpc systems, spinlock acquisition does not order prior stores > against later loads. This means that this statement: > > rfcp->rfc_next = NULL; > > Can be reordered to follow this statement: > > WRITE_ONCE(*rfcpp, rfcp); > > Which is then a data race with rcu_torture_fwd_prog_cr(), specifically, > this statement: > > rfcpn = READ_ONCE(rfcp->rfc_next) > > KCSAN located this data race, which represents a real failure on powerpc. > > Signed-off-by: Paul E. McKenney > Cc: Marco Elver > Cc: Andrey Konovalov > Cc: Nice find - was this found by KCSAN's weak memory modeling, i.e. the report showed you that a reordered access resulted in a data race? Acked-by: Marco Elver > --- > kernel/rcu/rcutorture.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index 44cc455e1b615..cafe047d046e8 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -2630,7 +2630,7 @@ static void rcu_torture_fwd_cb_cr(struct rcu_head *rhp) > spin_lock_irqsave(&rfp->rcu_fwd_lock, flags); > rfcpp = rfp->rcu_fwd_cb_tail; > rfp->rcu_fwd_cb_tail = &rfcp->rfc_next; > - WRITE_ONCE(*rfcpp, rfcp); > + smp_store_release(rfcpp, rfcp); > WRITE_ONCE(rfp->n_launders_cb, rfp->n_launders_cb + 1); > i = ((jiffies - rfp->rcu_fwd_startat) / (HZ / FWD_CBS_HIST_DIV)); > if (i >= ARRAY_SIZE(rfp->n_launders_hist)) > -- > 2.40.1 >