From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
To: Daniel Borkmann <daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] cgroup: net_cls: fix false-positive "suspicious RCU usage"
Date: Wed, 22 Jul 2015 15:03:42 +0300 [thread overview]
Message-ID: <55AF869E.4030304@yandex-team.ru> (raw)
In-Reply-To: <55AF84FC.2070502-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
On 22.07.2015 14:56, Daniel Borkmann wrote:
> On 07/22/2015 11:23 AM, Konstantin Khlebnikov wrote:
>> In dev_queue_xmit() net_cls protected with rcu-bh.
> ...
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
>> ---
>> net/core/netclassid_cgroup.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
>> index 1f2a126f4ffa..6441f47b1a8f 100644
>> --- a/net/core/netclassid_cgroup.c
>> +++ b/net/core/netclassid_cgroup.c
>> @@ -23,7 +23,8 @@ static inline struct cgroup_cls_state
>> *css_cls_state(struct cgroup_subsys_state
>>
>> struct cgroup_cls_state *task_cls_state(struct task_struct *p)
>> {
>> - return css_cls_state(task_css(p, net_cls_cgrp_id));
>> + return css_cls_state(task_css_check(p, net_cls_cgrp_id,
>> + rcu_read_lock_bh_held()));
>
> Did you also check that after your patch this doesn't trigger on ingress
> either? There, this code path could be invoked under rcu_read_lock(). So,
> perhaps you need to check for both.
I haven't seen warnings with this patch. rcu_read_lock_held() is
checked inside rcu_dereference_check() inside task_css_check().
So, overall check expression is:
lockdep_is_held(&cgroup_mutex) || <- in task_css_set_check
lockdep_is_held(&css_set_rwsem) ||
((task)->flags & PF_EXITING) ||
rcu_read_lock_bh_held() || <- mine
rcu_read_lock_held() <- in rcu_dereference_check
>
>> }
>> EXPORT_SYMBOL_GPL(task_cls_state);
--
Konstantin
next prev parent reply other threads:[~2015-07-22 12:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 16:46 [PATCH] cgroup: net_cls: fix false-positive "suspicious RCU usage" Konstantin Khlebnikov
2015-07-22 5:28 ` David Miller
2015-07-22 9:23 ` [PATCH v2] " Konstantin Khlebnikov
2015-07-22 11:56 ` Daniel Borkmann
[not found] ` <55AF84FC.2070502-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
2015-07-22 12:03 ` Konstantin Khlebnikov [this message]
[not found] ` <55AF869E.4030304-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
2015-07-22 12:06 ` Daniel Borkmann
2015-07-25 7:13 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55AF869E.4030304@yandex-team.ru \
--to=khlebnikov-xojtrxgx1jsebxzfvpsj4g@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).