* [PATCH RESEND] device_cgroup: Fix RCU list debugging warning @ 2020-04-06 10:59 Amol Grover 2020-06-06 20:23 ` Stephen Rothwell 0 siblings, 1 reply; 7+ messages in thread From: Amol Grover @ 2020-04-06 10:59 UTC (permalink / raw) To: James Morris, Serge E . Hallyn Cc: linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, Paul E . McKenney, linux-security-module, Amol Grover 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 <frextrite@gmail.com> --- 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-04-06 10:59 [PATCH RESEND] device_cgroup: Fix RCU list debugging warning Amol Grover @ 2020-06-06 20:23 ` Stephen Rothwell 2020-06-07 19:08 ` Paul E. McKenney 0 siblings, 1 reply; 7+ messages in thread From: Stephen Rothwell @ 2020-06-06 20:23 UTC (permalink / raw) To: Amol Grover Cc: James Morris, Serge E . Hallyn, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, Paul E . McKenney, linux-security-module [-- Attachment #1: Type: text/plain, Size: 1810 bytes --] Hi all, On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <frextrite@gmail.com> 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 <frextrite@gmail.com> > --- > 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? -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-06-06 20:23 ` Stephen Rothwell @ 2020-06-07 19:08 ` Paul E. McKenney 2020-06-08 4:17 ` Serge E. Hallyn 0 siblings, 1 reply; 7+ messages in thread From: Paul E. McKenney @ 2020-06-07 19:08 UTC (permalink / raw) To: Stephen Rothwell Cc: Amol Grover, James Morris, Serge E . Hallyn, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, linux-security-module 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 <frextrite@gmail.com> 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 <frextrite@gmail.com> > > --- > > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-06-07 19:08 ` Paul E. McKenney @ 2020-06-08 4:17 ` Serge E. Hallyn 2020-08-17 2:07 ` Stephen Rothwell 0 siblings, 1 reply; 7+ messages in thread From: Serge E. Hallyn @ 2020-06-08 4:17 UTC (permalink / raw) To: Paul E. McKenney Cc: Stephen Rothwell, Amol Grover, James Morris, Serge E . Hallyn, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, linux-security-module On Sun, Jun 07, 2020 at 12:08:40PM -0700, Paul E. McKenney wrote: > 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 <frextrite@gmail.com> 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 <frextrite@gmail.com> > > > --- > > > 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 James, do you mind pulling it in? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-06-08 4:17 ` Serge E. Hallyn @ 2020-08-17 2:07 ` Stephen Rothwell 2020-08-20 18:28 ` James Morris 0 siblings, 1 reply; 7+ messages in thread From: Stephen Rothwell @ 2020-08-17 2:07 UTC (permalink / raw) To: Amol Grover, James Morris Cc: Serge E. Hallyn, Paul E. McKenney, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, linux-security-module [-- Attachment #1: Type: text/plain, Size: 2603 bytes --] Hi all, On Sun, 7 Jun 2020 23:17:34 -0500 "Serge E. Hallyn" <serge@hallyn.com> wrote: > On Sun, Jun 07, 2020 at 12:08:40PM -0700, Paul E. McKenney wrote: > > On Sun, Jun 07, 2020 at 06:23:40AM +1000, Stephen Rothwell wrote: > > > > > > On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <frextrite@gmail.com> 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 <frextrite@gmail.com> > > > > --- > > > > 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)) > > > > > > 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. > > James, do you mind pulling it in? I am still carrying this patch. Has it been superceded, or is it still necessary? -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-08-17 2:07 ` Stephen Rothwell @ 2020-08-20 18:28 ` James Morris 2020-08-20 22:38 ` Stephen Rothwell 0 siblings, 1 reply; 7+ messages in thread From: James Morris @ 2020-08-20 18:28 UTC (permalink / raw) To: Stephen Rothwell Cc: Amol Grover, Serge E. Hallyn, Paul E. McKenney, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, linux-security-module On Mon, 17 Aug 2020, Stephen Rothwell wrote: > > > 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. > > > > James, do you mind pulling it in? > > I am still carrying this patch. Has it been superceded, or is it still > necessary? It appears to be necessary. Applied to git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git fixes-v5.9 -- James Morris <jmorris@namei.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] device_cgroup: Fix RCU list debugging warning 2020-08-20 18:28 ` James Morris @ 2020-08-20 22:38 ` Stephen Rothwell 0 siblings, 0 replies; 7+ messages in thread From: Stephen Rothwell @ 2020-08-20 22:38 UTC (permalink / raw) To: James Morris Cc: Amol Grover, Serge E. Hallyn, Paul E. McKenney, linux-kernel, linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik, linux-security-module [-- Attachment #1: Type: text/plain, Size: 659 bytes --] Hi James, On Fri, 21 Aug 2020 04:28:34 +1000 (AEST) James Morris <jmorris@namei.org> wrote: > > On Mon, 17 Aug 2020, Stephen Rothwell wrote: > > > > > 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. > > > > > > James, do you mind pulling it in? > > > > I am still carrying this patch. Has it been superceded, or is it still > > necessary? > > It appears to be necessary. > > Applied to > git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git fixes-v5.9 Thanks, I have dropped my copy. -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-20 22:38 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-06 10:59 [PATCH RESEND] device_cgroup: Fix RCU list debugging warning Amol Grover 2020-06-06 20:23 ` Stephen Rothwell 2020-06-07 19:08 ` Paul E. McKenney 2020-06-08 4:17 ` Serge E. Hallyn 2020-08-17 2:07 ` Stephen Rothwell 2020-08-20 18:28 ` James Morris 2020-08-20 22:38 ` Stephen Rothwell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).