Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp3838145ybg; Sun, 7 Jun 2020 12:10:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy12yTMMuvn95KDWJMb8AD9B+eLGFcLAhfMN8/l0dgZvhZy6SVdTydjsNk88rx1fSt5gDWu X-Received: by 2002:aa7:dc4e:: with SMTP id g14mr18665285edu.346.1591557051928; Sun, 07 Jun 2020 12:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591557051; cv=none; d=google.com; s=arc-20160816; b=yrJMo32jSrICqN1SgueMUrpt0IsyANMijOEqAtoeI5e9CcQS+Sc5A/HLxO7udTJVMa 4QaDEbmNRuslv+g2ACN3+8JZuM3nUP7SbJ7v8QJfTVKc2jrF1efZYMm7z7fGR2DlyL5N /zLKUlRWFXsizK9jH63h6+zMT/5OFllR6Aa/dx8T9cg0+XAIUWioDAcKiOqekjsidmaX Pdv69nodA4BQD6ZYdGwJYr0pXh2un5LPsnX+dNKwjiV7bLLr8SQFD3tolnbJZvUKFGEQ 9XE6zIbKUvTr9mU154VNtbfDUjrPU+6dmAnbBxijI8CgTTWb/fW3VFVKHsliSwUYsjyJ 4Fcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=XDK39Br6m6kINIzOBIxkw5bpC5ALBmBpOZolLSFdHtg=; b=QcGaB6MSRVu7GEKOQ/xQo3BS9QfQ7YoENxYF1u3Ge55v8mFwNSE3OD1wroGZeqktTF i3wBK8+kd0olpXdTQNsH0dNejl5xrsZNMqjvTGM5HqID5pu8bHArVgJT3kMi8pOY79Ob aIQ+3Ybn91IoS4HilZZWee1UWb6npH11FTfQAfu7+N1S4IVAEPAhWu9qS5RRKQKVKxr+ khYewSJVIgHZLPQbAOFspSp6/aYXoId44tX87TO+L0RFHd/9uiD4QT1k1roaufu4yAL+ VoODsskV7NSqfglGHOuoWdFN1lpezEm3wL6Q5uQHbYVY4R8L2VuH1i5X1NY7eMseD5k+ HPiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jvuyLO1l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si7229351ejr.36.2020.06.07.12.10.27; Sun, 07 Jun 2020 12:10:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=jvuyLO1l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727069AbgFGTIl (ORCPT + 99 others); Sun, 7 Jun 2020 15:08:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:40634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbgFGTIk (ORCPT ); Sun, 7 Jun 2020 15:08:40 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CCBA206D5; Sun, 7 Jun 2020 19:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591556920; bh=aimXNnD+PVaJEw0UQzhYrUjR4ij+FbdM/GXqDgyISfM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=jvuyLO1ljh8cBnSYm7M6fodXklTc77xJLwa8pAKuyjAjcyReM6xvxvPrh8ZwfwD4b /xXmMuV+ffG9xOYKRHXAgMSfgvDERF+SK9+qGfoexGh7o7UINMpLqQQi/0NWXNempY TU3m1ybhV3vklUqBBuexkjzzVAcZ3xuAmOcmHRAI= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 59EEB35228C7; Sun, 7 Jun 2020 12:08:40 -0700 (PDT) Date: Sun, 7 Jun 2020 12:08:40 -0700 From: "Paul E. McKenney" To: Stephen Rothwell Cc: Amol Grover , James Morris , "Serge E . Hallyn" , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , linux-security-module@vger.kernel.org Subject: Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning Message-ID: <20200607190840.GG4455@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200406105950.GA2285@workstation-kernel-dev> <20200607062340.7be7e8d5@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200607062340.7be7e8d5@canb.auug.org.au> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 07, 2020 at 06:23:40AM +1000, Stephen Rothwell wrote: > Hi all, > > On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover wrote: > > > > exceptions may be traversed using list_for_each_entry_rcu() > > outside of an RCU read side critical section BUT under the > > protection of decgroup_mutex. Hence add the corresponding > > lockdep expression to fix the following false-positive > > warning: > > > > [ 2.304417] ============================= > > [ 2.304418] WARNING: suspicious RCU usage > > [ 2.304420] 5.5.4-stable #17 Tainted: G E > > [ 2.304422] ----------------------------- > > [ 2.304424] security/device_cgroup.c:355 RCU-list traversed in non-reader section!! > > > > Signed-off-by: Amol Grover > > --- > > security/device_cgroup.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/security/device_cgroup.c b/security/device_cgroup.c > > index 7d0f8f7431ff..b7da9e0970d9 100644 > > --- a/security/device_cgroup.c > > +++ b/security/device_cgroup.c > > @@ -352,7 +352,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type, > > { > > struct dev_exception_item *ex; > > > > - list_for_each_entry_rcu(ex, exceptions, list) { > > + list_for_each_entry_rcu(ex, exceptions, list, > > + lockdep_is_held(&devcgroup_mutex)) { > > if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK)) > > continue; > > if ((type & DEVCG_DEV_CHAR) && !(ex->type & DEVCG_DEV_CHAR)) > > -- > > 2.24.1 > > > > I have been carrying the above patch in linux-next for some time now. > I have been carrying it because it fixes problems for syzbot (see the > third warning in > https://lore.kernel.org/linux-next/CACT4Y+YnjK+kq0pfb5fe-q1bqe2T1jq_mvKHf--Z80Z3wkyK1Q@mail.gmail.com/). > Is there some reason it has not been applied to some tree? The RCU changes on which this patch depends have long since made it to mainline, so it can go up any tree. I can take it if no one else will, but it might be better going in via the security tree. Thanx, Paul