lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 24 Nov 2008 12:45:49 -0800
From:	Paul Menage <menage@...gle.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linux Containers <containers@...ts.linux-foundation.org>,
	Li Zefan <lizf@...fujitsu.com>
Subject: Re: [PATCH] cgroups: fix incorrect using rcu_dereference() in 
	cgroup_subsys_state()

On Fri, Nov 21, 2008 at 7:22 PM, Lai Jiangshan <laijs@...fujitsu.com> wrote:
>> No, if you use cgroup_lock() you can do this for any task.
>> cgroup_lock() is the cgroups equivalent of the BKL, and definitely
>> prevents all task movement between groups.
>
> cgroup_exit() will defeat you.

Ah, good point. You should mention that in your description of the
locking rules. But it would be nice if we could get rid of that
restriction.

Paul

>
>>>  static inline struct cgroup_subsys_state *task_subsys_state(
>>>        struct task_struct *task, int subsys_id)
>>>  {
>>> -       return rcu_dereference(task->cgroups->subsys[subsys_id]);
>>> +       /*
>>> +        * ->subsys[subsys_id] are read-only data, so we do not need
>>> +        * rcu_dereference() for it.
>>> +        */
>>> +       return rcu_dereference(task->cgroups)->subsys[subsys_id];
>>>  }
>>
>> Change looks OK but I think we can lose the additional comment.
>>
>> Paul
>>
>>
>>
>
> I just remembered I had deferred Li Zefan's patch.
> (I'm also RCU developer, I had been writing CGROUP VS RCU then,
> I thought these patches should be sent together, So I deferred his patch)
>
> From: Li Zefan <lizf@...fujitsu.com>
> Date: Mon, 25 Aug 2008 11:05:28 +0800
> Subject: [PATCH] cgroup: fix wrong rcu_dereference()
>
> It is tsk->cgroups which is protected by RCU.
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> ---
>  include/linux/cgroup.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index c98dd7c..d911dc7 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -355,7 +355,7 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
>  static inline struct cgroup_subsys_state *task_subsys_state(
>        struct task_struct *task, int subsys_id)
>  {
> -       return rcu_dereference(task->cgroups->subsys[subsys_id]);
> +       return rcu_dereference(task->cgroups)->subsys[subsys_id];
>  }
>
>  static inline struct cgroup* task_cgroup(struct task_struct *task,
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ