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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Jul 2020 16:50:37 +0200
From:   Christian Brauner <christian.brauner@...ntu.com>
To:     Kirill Tkhai <ktkhai@...tuozzo.com>
Cc:     viro@...iv.linux.org.uk, adobriyan@...il.com, davem@...emloft.net,
        ebiederm@...ssion.com, akpm@...ux-foundation.org,
        areber@...hat.com, serge@...lyn.com, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 07/23] cgroup: Use generic ns_common::count

On Thu, Jul 30, 2020 at 02:59:57PM +0300, Kirill Tkhai wrote:
> Convert cgroup namespace to use generic counter.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
> ---

Looks good!
Acked-by: Christian Brauner <christian.brauner@...ntu.com>

>  include/linux/cgroup.h    |    5 ++---
>  kernel/cgroup/cgroup.c    |    2 +-
>  kernel/cgroup/namespace.c |    2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 618838c48313..451c2d26a5db 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -854,7 +854,6 @@ static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
>  #endif	/* CONFIG_CGROUP_DATA */
>  
>  struct cgroup_namespace {
> -	refcount_t		count;
>  	struct ns_common	ns;
>  	struct user_namespace	*user_ns;
>  	struct ucounts		*ucounts;
> @@ -889,12 +888,12 @@ copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
>  static inline void get_cgroup_ns(struct cgroup_namespace *ns)
>  {
>  	if (ns)
> -		refcount_inc(&ns->count);
> +		refcount_inc(&ns->ns.count);
>  }
>  
>  static inline void put_cgroup_ns(struct cgroup_namespace *ns)
>  {
> -	if (ns && refcount_dec_and_test(&ns->count))
> +	if (ns && refcount_dec_and_test(&ns->ns.count))
>  		free_cgroup_ns(ns);
>  }
>  
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index dd247747ec14..22e466926853 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -199,7 +199,7 @@ static u16 have_canfork_callback __read_mostly;
>  
>  /* cgroup namespace for init task */
>  struct cgroup_namespace init_cgroup_ns = {
> -	.count		= REFCOUNT_INIT(2),
> +	.ns.count	= REFCOUNT_INIT(2),
>  	.user_ns	= &init_user_ns,
>  	.ns.ops		= &cgroupns_operations,
>  	.ns.inum	= PROC_CGROUP_INIT_INO,
> diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
> index 812a61afd538..f5e8828c109c 100644
> --- a/kernel/cgroup/namespace.c
> +++ b/kernel/cgroup/namespace.c
> @@ -32,7 +32,7 @@ static struct cgroup_namespace *alloc_cgroup_ns(void)
>  		kfree(new_ns);
>  		return ERR_PTR(ret);
>  	}
> -	refcount_set(&new_ns->count, 1);
> +	refcount_set(&new_ns->ns.count, 1);
>  	new_ns->ns.ops = &cgroupns_operations;
>  	return new_ns;
>  }
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ