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]
Message-ID: <3fjdecxh2a76ugqui4gke2qrl53n7l7ujmij3kf26arlrmgx5t@adnhg27vve54>
Date: Wed, 17 Sep 2025 18:30:51 +0200
From: Jan Kara <jack@...e.cz>
To: Christian Brauner <brauner@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, Amir Goldstein <amir73il@...il.com>, 
	Josef Bacik <josef@...icpanda.com>, Jeff Layton <jlayton@...nel.org>, Mike Yuan <me@...dnzj.com>, 
	Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>, Lennart Poettering <mzxreary@...inter.de>, 
	Daan De Meyer <daan.j.demeyer@...il.com>, Aleksa Sarai <cyphar@...har.com>, 
	Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, Tejun Heo <tj@...nel.org>, 
	Johannes Weiner <hannes@...xchg.org>, Michal Koutný <mkoutny@...e.com>, 
	Jakub Kicinski <kuba@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>, 
	Frederic Weisbecker <frederic@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, cgroups@...r.kernel.org, 
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 4/9] cgroup: split namespace into separate header

On Wed 17-09-25 12:28:03, Christian Brauner wrote:
> We have dedicated headers for all namespace types. Add one for the
> cgroup namespace as well. Now it's consistent for all namespace types
> and easy to figure out what to include.
> 
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  include/linux/cgroup.h           | 51 +-----------------------------------
>  include/linux/cgroup_namespace.h | 56 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 57 insertions(+), 50 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 9ca25346f7cb..5156fed8cbc3 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -27,6 +27,7 @@
>  #include <linux/kernel_stat.h>
>  
>  #include <linux/cgroup-defs.h>
> +#include <linux/cgroup_namespace.h>
>  
>  struct kernel_clone_args;
>  
> @@ -783,56 +784,6 @@ static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
>  
>  #endif	/* CONFIG_CGROUP_DATA */
>  
> -struct cgroup_namespace {
> -	struct ns_common	ns;
> -	struct user_namespace	*user_ns;
> -	struct ucounts		*ucounts;
> -	struct css_set          *root_cset;
> -};
> -
> -extern struct cgroup_namespace init_cgroup_ns;
> -
> -#ifdef CONFIG_CGROUPS
> -
> -static inline struct cgroup_namespace *to_cg_ns(struct ns_common *ns)
> -{
> -	return container_of(ns, struct cgroup_namespace, ns);
> -}
> -
> -void free_cgroup_ns(struct cgroup_namespace *ns);
> -
> -struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
> -					struct user_namespace *user_ns,
> -					struct cgroup_namespace *old_ns);
> -
> -int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
> -		   struct cgroup_namespace *ns);
> -
> -static inline void get_cgroup_ns(struct cgroup_namespace *ns)
> -{
> -	refcount_inc(&ns->ns.count);
> -}
> -
> -static inline void put_cgroup_ns(struct cgroup_namespace *ns)
> -{
> -	if (refcount_dec_and_test(&ns->ns.count))
> -		free_cgroup_ns(ns);
> -}
> -
> -#else /* !CONFIG_CGROUPS */
> -
> -static inline void free_cgroup_ns(struct cgroup_namespace *ns) { }
> -static inline struct cgroup_namespace *
> -copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
> -	       struct cgroup_namespace *old_ns)
> -{
> -	return old_ns;
> -}
> -
> -static inline void get_cgroup_ns(struct cgroup_namespace *ns) { }
> -static inline void put_cgroup_ns(struct cgroup_namespace *ns) { }
> -
> -#endif /* !CONFIG_CGROUPS */
>  
>  #ifdef CONFIG_CGROUPS
>  
> diff --git a/include/linux/cgroup_namespace.h b/include/linux/cgroup_namespace.h
> new file mode 100644
> index 000000000000..c02bb76c5e32
> --- /dev/null
> +++ b/include/linux/cgroup_namespace.h
> @@ -0,0 +1,56 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_CGROUP_NAMESPACE_H
> +#define _LINUX_CGROUP_NAMESPACE_H
> +
> +struct cgroup_namespace {
> +	struct ns_common	ns;
> +	struct user_namespace	*user_ns;
> +	struct ucounts		*ucounts;
> +	struct css_set          *root_cset;
> +};
> +
> +extern struct cgroup_namespace init_cgroup_ns;
> +
> +#ifdef CONFIG_CGROUPS
> +
> +static inline struct cgroup_namespace *to_cg_ns(struct ns_common *ns)
> +{
> +	return container_of(ns, struct cgroup_namespace, ns);
> +}
> +
> +void free_cgroup_ns(struct cgroup_namespace *ns);
> +
> +struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
> +					struct user_namespace *user_ns,
> +					struct cgroup_namespace *old_ns);
> +
> +int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
> +		   struct cgroup_namespace *ns);
> +
> +static inline void get_cgroup_ns(struct cgroup_namespace *ns)
> +{
> +	refcount_inc(&ns->ns.count);
> +}
> +
> +static inline void put_cgroup_ns(struct cgroup_namespace *ns)
> +{
> +	if (refcount_dec_and_test(&ns->ns.count))
> +		free_cgroup_ns(ns);
> +}
> +
> +#else /* !CONFIG_CGROUPS */
> +
> +static inline void free_cgroup_ns(struct cgroup_namespace *ns) { }
> +static inline struct cgroup_namespace *
> +copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
> +	       struct cgroup_namespace *old_ns)
> +{
> +	return old_ns;
> +}
> +
> +static inline void get_cgroup_ns(struct cgroup_namespace *ns) { }
> +static inline void put_cgroup_ns(struct cgroup_namespace *ns) { }
> +
> +#endif /* !CONFIG_CGROUPS */
> +
> +#endif /* _LINUX_CGROUP_NAMESPACE_H */
> 
> -- 
> 2.47.3
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ