Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp821168rwe; Wed, 31 Aug 2022 11:35:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WqS37m8V7DLZ4Op1nt6hcKPpO31YssfxFE+MsNDDnXCu7YV6sTNsare0i2Ux8EVWAsSig X-Received: by 2002:a17:907:9712:b0:731:67db:1b48 with SMTP id jg18-20020a170907971200b0073167db1b48mr21166003ejc.754.1661970925943; Wed, 31 Aug 2022 11:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661970925; cv=none; d=google.com; s=arc-20160816; b=v2vEloRpkX/6SK+V7RJSu6fMCzP2Z6WaLEzR5pqaGGQLlNqk6rbjV/Aip0FEAU3Hbk zQ6M3ZiRLiSPDVyvBtgfMinm77LnwRoL3LhKPkHJFxTbicGAwf/khz1NWz/fg+zBa2Ai aNSlKvoSzqydZhcbAt0uVlBY43PLKSCEP3aExE3gqPG4/VOP58OF8IDduClGLQ9p2zgt 47IQK+lusrBKaGLpgTwZnUWfPjTeeQQyZ0NHL75pHYxJSyVdq4mXXGSzYgT+xkXkIyF7 blPU5U37M1s/MEgnsgWEDx4oTIUX4B5Iv3F5EyeylNmvQrRF5z0rPQrtkMzPu91A6S2/ dttw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wX8U2kP9XofevFHq4izRY1wkVyBVuajbJd7yoq3ZLsg=; b=0AnWVq9LHeEzRzQgwC65a1Mz4+mgVtQwPqvCqQjlQ650kVAOMzQEZbxhLF6U+50mAR 197SiIhBRDWt34JTBpcI5rCmpuDnt7xG+X87DpsaruUECkXC6e65MJqJHN4l3lR/tt8M pTvRFREQ4ypO7E3Sp+I6QLhOWoYJNnMNcpta0ZkIpbQcH3MF+saxyJaMY6O9hwHmxqBw dFYBfey0OLOzcfS2ZQQzOpbr57Ju8RnAV2HI54tZWegf+qJGYcciACNvgUGytIzqU5wv 7fvKUnzSi5fH34PKx54VlHv1s6FPxwPxAZsuFGWXGRXYSi36mAPKv9y/hRJ950z3C4RI ZAKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m2hHmhTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh38-20020a1709076ea600b007309a570223si10443513ejc.609.2022.08.31.11.34.57; Wed, 31 Aug 2022 11:35:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m2hHmhTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232931AbiHaS0a (ORCPT + 99 others); Wed, 31 Aug 2022 14:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbiHaSZh (ORCPT ); Wed, 31 Aug 2022 14:25:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464F1A2DAC for ; Wed, 31 Aug 2022 11:21:53 -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 824F6B82274 for ; Wed, 31 Aug 2022 18:21:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 274F7C433D7; Wed, 31 Aug 2022 18:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661970110; bh=PbgqrlZZosHYbW1nGq71ZuCzDyWkjMJCAl8bHAx5ujs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2hHmhTlnhrQBP23DC4aegtGLyEdtj+cabH/135m81FavzC3rZTMlAUHM0+jOTupX b5mjGnFAGF0lle8toXNjpYU4hBkGvv1Pi0g5Du3ag+bYnhfgdmSS4EeJmdb51z+CO7 Ni6QqW3/Z5M6xQLdJk+iRjSqjcwKr9tpR1nYKoUR+bPXe5QTK3IsElV+GCOtDDDIPV GOMi4WtfuOqN3ScnYfbFWYH7D/cQqLrgLizFNGF9mF5Cnz+wbUUanCacq5vqy4ykbN cR1Zt786nh3WsneWxtNbhNwr8uGftZrf9ThZfkYO/iufD4hIBLVIMyR6+wzwC/N2el Ajq5eRSNJhDpg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D35715C02A9; Wed, 31 Aug 2022 11:21:49 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@fb.com, w@lwt.eu, Zqiang , "Paul E . McKenney" Subject: [PATCH rcu 2/2] rcutorture: Use the barrier operation specified by cur_ops Date: Wed, 31 Aug 2022 11:21:31 -0700 Message-Id: <20220831182148.2698489-3-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20220831182113.GA2697286@paulmck-ThinkPad-P17-Gen-1> References: <20220831182113.GA2697286@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Zqiang The rcutorture_oom_notify() function unconditionally invokes rcu_barrier(), which is OK when the rcutorture.torture_type value is "rcu", but unhelpful otherwise. The purpose of these barrier calls is to wait for all outstanding callback-flooding callbacks to be invoked before cleaning up their data. Using the wrong barrier function therefore risks arbitrary memory corruption. Thus, this commit changes these rcu_barrier() calls into cur_ops->cb_barrier() to make things work when torturing non-vanilla flavors of RCU. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index d8e1b270a065f..08b7b59d5d05b 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2600,12 +2600,12 @@ static int rcutorture_oom_notify(struct notifier_block *self, for (i = 0; i < fwd_progress; i++) ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]); pr_info("%s: Freed %lu RCU callbacks.\n", __func__, ncbs); - rcu_barrier(); + cur_ops->cb_barrier(); ncbs = 0; for (i = 0; i < fwd_progress; i++) ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]); pr_info("%s: Freed %lu RCU callbacks.\n", __func__, ncbs); - rcu_barrier(); + cur_ops->cb_barrier(); ncbs = 0; for (i = 0; i < fwd_progress; i++) ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]); -- 2.31.1.189.g2e36527f23