Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp844945pxb; Wed, 6 Apr 2022 01:40:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNAHR1Q21hZOCA8Z020ODc6sJhEipDFMJtM8gq//EhApCVmjDM1O6sql/aHPPjW05UqfsW X-Received: by 2002:a63:1e52:0:b0:380:ae84:256e with SMTP id p18-20020a631e52000000b00380ae84256emr6316086pgm.84.1649234413230; Wed, 06 Apr 2022 01:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649234413; cv=none; d=google.com; s=arc-20160816; b=gJJkJGg/9OfAeHpnx7lauLvX0lRMGrLbuuKGvYq3R9cTLgsVyQYUI/5R4RUrbDAZF4 d0uiuzZslab6evnv/nZv1AjMoMYVBK459qVjTRoFhG01YKCdPiawV3VBA+RTaIyqFvOu wh2BLH/1LovogyQ52IhNK+n2N0pzd1HlWJ6namOSvgexR+BP0rcYNC3u7CsJ2LwG1BPM ehoTrd/rOUSn21qMYFtFc9wp2wpNd0Ne1h0LOc8zsFYMdUcY/XcxlZ1yy1pJ416rYfQc eA3FDwHn44y+Nj5I5e6Y+TccGMB+ZCRk8oUBG+7ZMRJfdyUtozABoRG9wVdinzEk9VBD S27A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4G90kGNoCZE8TGShdR44ViuEUSqodLorp1eQ9Ue52Hs=; b=Wz7Vg2GTB2er5EJIcIC+skuMPi8jcGGR08FbswDD46rLWmPHtFg20yQyou3hPGR9P8 4DJ0UyRcb6igc9srkhM2zUtysZX39SwQzHlJpcnHFg0vU4dsCs+p+yhDSf5oxIV4GVVE 10K4H+rhFg6gIHsolMVqf9u3O8xRl29bGsqFGncXK9vvzCjVLqA0qpowirXX4w3o41qd nTQCnCN+WXeQSktsf2z90QRiYNlnLWuocTD3cnYnRgJ5VcpKEdflymFJaJLRBkTQZTUc Wp1cacZVNbUD7jc6Qh2eJJTMojFfw+56MhovYEofSntqNmqjyWjc8ilmhRzr4quD5mil 1HNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSLzjBUQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d37-20020a631d65000000b003816043ee58si15356781pgm.77.2022.04.06.01.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 01:40:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSLzjBUQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 071C3576819; Wed, 6 Apr 2022 01:26:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376634AbiDEV0u (ORCPT + 99 others); Tue, 5 Apr 2022 17:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349861AbiDEJvt (ORCPT ); Tue, 5 Apr 2022 05:51:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8014528E14; Tue, 5 Apr 2022 02:49:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CA5DB818F3; Tue, 5 Apr 2022 09:49:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9407EC385A1; Tue, 5 Apr 2022 09:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152189; bh=aHqT1HFZ5CvSbqfy/C/L/NOwod6STlMUwvXPGsSKQro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSLzjBUQXqYSnClEP1pmPMPyJSrjOV6PoNDs6UACNuX/2TKJxG8K3HsfOstOCoAWL YR6lEaJEnPE/ADLxXb7/as/6Pe1T7y7mBs2hwThTRcJxPkHAIiFPjDmwzsXxaxspRG /ySbFjATalvMB/1clDijQ4CRUvBnp5h/g1JpyGeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhouyi Zhou , "Paul E. McKenney" , Frederic Weisbecker , Sasha Levin Subject: [PATCH 5.15 687/913] rcu: Mark writes to the rcu_segcblist structures ->flags field Date: Tue, 5 Apr 2022 09:29:09 +0200 Message-Id: <20220405070400.427411819@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul E. McKenney [ Upstream commit c09929031018913b5783872a8b8cdddef4a543c7 ] KCSAN reports data races between the rcu_segcblist_clear_flags() and rcu_segcblist_set_flags() functions, though misreporting the latter as a call to rcu_segcblist_is_enabled() from call_rcu(). This commit converts the updates of this field to WRITE_ONCE(), relying on the resulting unmarked reads to continue to detect buggy concurrent writes to this field. Reported-by: Zhouyi Zhou Signed-off-by: Paul E. McKenney Cc: Frederic Weisbecker Signed-off-by: Sasha Levin --- kernel/rcu/rcu_segcblist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcu_segcblist.h b/kernel/rcu/rcu_segcblist.h index 9a19328ff251..5d405943823e 100644 --- a/kernel/rcu/rcu_segcblist.h +++ b/kernel/rcu/rcu_segcblist.h @@ -56,13 +56,13 @@ static inline long rcu_segcblist_n_cbs(struct rcu_segcblist *rsclp) static inline void rcu_segcblist_set_flags(struct rcu_segcblist *rsclp, int flags) { - rsclp->flags |= flags; + WRITE_ONCE(rsclp->flags, rsclp->flags | flags); } static inline void rcu_segcblist_clear_flags(struct rcu_segcblist *rsclp, int flags) { - rsclp->flags &= ~flags; + WRITE_ONCE(rsclp->flags, rsclp->flags & ~flags); } static inline bool rcu_segcblist_test_flags(struct rcu_segcblist *rsclp, -- 2.34.1