All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
To: Konstantin Khlebnikov
	<khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@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 14:06:57 +0200	[thread overview]
Message-ID: <55AF8761.5020804@iogearbox.net> (raw)
In-Reply-To: <55AF869E.4030304-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>

On 07/22/2015 02:03 PM, Konstantin Khlebnikov wrote:
> 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().

Thanks, agreed.

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Borkmann <daniel@iogearbox.net>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Tejun Heo <tj@kernel.org>,
	cgroups@vger.kernel.org, Li Zefan <lizefan@huawei.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] cgroup: net_cls: fix false-positive "suspicious RCU usage"
Date: Wed, 22 Jul 2015 14:06:57 +0200	[thread overview]
Message-ID: <55AF8761.5020804@iogearbox.net> (raw)
In-Reply-To: <55AF869E.4030304@yandex-team.ru>

On 07/22/2015 02:03 PM, Konstantin Khlebnikov wrote:
> 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@yandex-team.ru>
>>> ---
>>>   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().

Thanks, agreed.

  parent reply	other threads:[~2015-07-22 12:06 UTC|newest]

Thread overview: 12+ 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-21 16:46 ` Konstantin Khlebnikov
2015-07-22  5:28 ` David Miller
2015-07-22  5:28   ` David Miller
2015-07-22  9:23 ` [PATCH v2] " Konstantin Khlebnikov
2015-07-22  9:23   ` 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
2015-07-22 12:03         ` Konstantin Khlebnikov
     [not found]         ` <55AF869E.4030304-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
2015-07-22 12:06           ` Daniel Borkmann [this message]
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=55AF8761.5020804@iogearbox.net \
    --to=daniel-fec+5ew28dpmcu3hniyyjq@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.