device_cgroup: Fix RCU list debugging warning
PATCH RESEND 1/1 device_cgroup: Fix RCU list debugging warning
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!!
--- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/device_cgroup.c +2 -1
@@ -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 ))
Signature · 1 line
2.24.1
Hi all,
Quoted 35 lines · On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <[email protected]> wrote:
exceptions may be traversed using
list_for_each_entry_rcu()outside of an RCU read side critical section BUT under the protection ofdecgroup_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 <[email protected]>--- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/device_cgroup.c +2
-1@@ -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 ))Signature · 1 line
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?
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 29 lines · Stephen Rothwell
Hi all,
Quoted 26 lines · On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <[email protected]> wrote:
exceptions may be traversed using
list_for_each_entry_rcu()outside of an RCU read side critical section BUT under the protection ofdecgroup_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 <[email protected]>--- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/device_cgroup.c +0
-0@@ -352,7 +352,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type, {struct dev_exception_item *ex;
Quoted 15 lines
Quoted 9 lines
security/device_cgroup.c +2
-1-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 ))Signature · 1 line
2.24.1I 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
Serge E. Hallyn
maintainerQuoted 46 lines · Paul E. McKenney
Quoted 29 lines · Stephen Rothwell
Hi all,
Quoted 26 lines · On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <[email protected]> wrote:
exceptions may be traversed using
list_for_each_entry_rcu()outside of an RCU read side critical section BUT under the protection ofdecgroup_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 <[email protected]>--- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/device_cgroup.c +0
-0@@ -352,7 +352,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type, {struct dev_exception_item *ex;Quoted 15 lines
Quoted 9 lines
security/device_cgroup.c +2
-1-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 ))Signature · 1 line
2.24.1I 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?
Quoted 5 lines
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?
Hi all,
Quoted 43 lines · On Sun, 7 Jun 2020 23:17:34 -0500 "Serge E. Hallyn" <[email protected]> wrote:
Quoted 42 lines · Paul E. McKenney
Quoted 40 lines · Stephen Rothwell
Quoted 23 lines · On Mon, 6 Apr 2020 16:29:50 +0530 Amol Grover <[email protected]> wrote:
exceptions may be traversed using
list_for_each_entry_rcu()outside of an RCU read side critical section BUT under the protection ofdecgroup_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 <[email protected]>--- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/device_cgroup.c +0
-0security/device_cgroup.c static bool match_exception_partial(struct list_head *exceptions, short type, · line 359
Quoted 9 lines
security/device_cgroup.c +2
-1@@ -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?
Quoted 5 lines
Quoted 3 lines
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?
Signature · 2 lines
Cheers, Stephen Rothwell
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
James Morris
maintainerQuoted 7 lines · Stephen Rothwell
Quoted 4 lines
Quoted 2 lines
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 togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git fixes-v5.9
Signature · 2 lines
James Morris <[email protected]>
Hi James,
Quoted 8 lines · On Fri, 21 Aug 2020 04:28:34 +1000 (AEST) James Morris <[email protected]>…
Quoted 5 lines · Stephen Rothwell
Quoted 4 lines
Quoted 2 lines
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?
Quoted 7 lines
Quoted 2 lines
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.gitfixes-v5.9
Thanks, I have dropped my copy.
Signature · 2 lines
Cheers, Stephen Rothwell