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]
Message-ID: <AANLkTinG2UkH4nsPiM6=jhLFBujonK9e0yf5CijhuaZ_@mail.gmail.com>
Date:	Tue, 4 Jan 2011 17:31:47 -0800
From:	Paul Menage <menage@...gle.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Li Zefan <lizf@...fujitsu.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] cgroups: fix incorrect using rcu_dereference() in cgroup_subsys_state()

On Tue, Jan 4, 2011 at 12:18 AM, Lai Jiangshan <laijs@...fujitsu.com> wrote:
> From: Li Zefan <lizf@...fujitsu.com>
> Date: Mon, 25 Aug 2008 11:05:28 +0800
> (Original) Subject: [PATCH] cgroup: fix wrong rcu_dereference()
>
> It is tsk->cgroups which is protected by RCU, not ->subsys[subsys_id].
>
> laijs: updated it(the surrounding code have been changed since these two years).
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index ed4ba11..a798814 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -535,10 +535,11 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
>  * cgroup_subsys::attach() methods.
>  */
>  #define task_subsys_state_check(task, subsys_id, __c)                  \
> -       rcu_dereference_check(task->cgroups->subsys[subsys_id],         \
> +       rcu_dereference_check(task->cgroups,                            \
>                              rcu_read_lock_held() ||                   \
>                              lockdep_is_held(&task->alloc_lock) ||     \
> -                             cgroup_lock_is_held() || (__c))
> +                             cgroup_lock_is_held() ||                  \
> +                             (__c))->subsys[subsys_id]

Can you reformat this a bit? It took a fair bit of staring to realize
that (__c))->subsys[subsys_id] wasn't trying to dereference __c.

Maybe make it:

#define task_subsys_state_check(task, subsys_id, __c) ({ \
  struct css_set *_css = rcu_dereference_check(...); \
  _css->subsys[subsys_id]; \
})

Paul
--
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