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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <uzg5z2g7yv2xbzj54nn37khy54kv5q7vj43w7qk3stebhxphc5@cnbj7tehxdpo>
Date: Wed, 17 Sep 2025 18:30:04 +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 3/9] nscommon: move to separate file

On Wed 17-09-25 12:28:02, Christian Brauner wrote:
> It's really awkward spilling the ns common infrastructure into multiple
> headers. Move it to a separate file.
> 
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Looks good. Feel free to add:

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

								Honza

> ---
>  include/linux/ns_common.h |  3 +++
>  include/linux/proc_ns.h   | 19 -------------------
>  kernel/Makefile           |  2 +-
>  kernel/nscommon.c         | 21 +++++++++++++++++++++
>  4 files changed, 25 insertions(+), 20 deletions(-)
> 
> diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
> index 7224072cccc5..78b17fe80b62 100644
> --- a/include/linux/ns_common.h
> +++ b/include/linux/ns_common.h
> @@ -31,6 +31,9 @@ struct ns_common {
>  	};
>  };
>  
> +int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
> +		   bool alloc_inum);
> +
>  #define to_ns_common(__ns)                              \
>  	_Generic((__ns),                                \
>  		struct cgroup_namespace *: &(__ns)->ns, \
> diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
> index 7f89f0829e60..9f21670b5824 100644
> --- a/include/linux/proc_ns.h
> +++ b/include/linux/proc_ns.h
> @@ -66,25 +66,6 @@ static inline void proc_free_inum(unsigned int inum) {}
>  
>  #endif /* CONFIG_PROC_FS */
>  
> -static inline int ns_common_init(struct ns_common *ns,
> -				 const struct proc_ns_operations *ops,
> -				 bool alloc_inum)
> -{
> -	if (alloc_inum) {
> -		int ret;
> -		ret = proc_alloc_inum(&ns->inum);
> -		if (ret)
> -			return ret;
> -	}
> -	refcount_set(&ns->count, 1);
> -	ns->stashed = NULL;
> -	ns->ops = ops;
> -	ns->ns_id = 0;
> -	RB_CLEAR_NODE(&ns->ns_tree_node);
> -	INIT_LIST_HEAD(&ns->ns_list_node);
> -	return 0;
> -}
> -
>  #define ns_free_inum(ns) proc_free_inum((ns)->inum)
>  
>  #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
> diff --git a/kernel/Makefile b/kernel/Makefile
> index b807516a1b43..1f48f7cd2d7b 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -8,7 +8,7 @@ obj-y     = fork.o exec_domain.o panic.o \
>  	    sysctl.o capability.o ptrace.o user.o \
>  	    signal.o sys.o umh.o workqueue.o pid.o task_work.o \
>  	    extable.o params.o \
> -	    kthread.o sys_ni.o nsproxy.o nstree.o \
> +	    kthread.o sys_ni.o nsproxy.o nstree.o nscommon.o \
>  	    notifier.o ksysfs.o cred.o reboot.o \
>  	    async.o range.o smpboot.o ucount.o regset.o ksyms_common.o
>  
> diff --git a/kernel/nscommon.c b/kernel/nscommon.c
> new file mode 100644
> index 000000000000..ebf4783d0505
> --- /dev/null
> +++ b/kernel/nscommon.c
> @@ -0,0 +1,21 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/ns_common.h>
> +
> +int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
> +		   bool alloc_inum)
> +{
> +	if (alloc_inum) {
> +		int ret;
> +		ret = proc_alloc_inum(&ns->inum);
> +		if (ret)
> +			return ret;
> +	}
> +	refcount_set(&ns->count, 1);
> +	ns->stashed = NULL;
> +	ns->ops = ops;
> +	ns->ns_id = 0;
> +	RB_CLEAR_NODE(&ns->ns_tree_node);
> +	INIT_LIST_HEAD(&ns->ns_list_node);
> +	return 0;
> +}
> 
> -- 
> 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