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: <fq4cc7z5ojnfeztco7o7e6ux6sggxiykvhrjoo5xlmycffwi6f@vjhrsneu3qct>
Date: Mon, 22 Sep 2025 15:42:32 +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>, 
	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/3] ns: add ns_debug()

On Mon 22-09-25 14:42:37, Christian Brauner wrote:
> Add ns_debug() that asserts that the correct operations are used for the
> namespace type.
> 
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Looks good. Feel free to add:

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

								Honza

> ---
>  kernel/nscommon.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/kernel/nscommon.c b/kernel/nscommon.c
> index 7aa2be6a0c32..3cef89ddef41 100644
> --- a/kernel/nscommon.c
> +++ b/kernel/nscommon.c
> @@ -2,6 +2,55 @@
>  
>  #include <linux/ns_common.h>
>  #include <linux/proc_ns.h>
> +#include <linux/vfsdebug.h>
> +
> +#ifdef CONFIG_DEBUG_VFS
> +static void ns_debug(struct ns_common *ns, const struct proc_ns_operations *ops)
> +{
> +	switch (ns->ops->type) {
> +#ifdef CONFIG_CGROUPS
> +	case CLONE_NEWCGROUP:
> +		VFS_WARN_ON_ONCE(ops != &cgroupns_operations);
> +		break;
> +#endif
> +#ifdef CONFIG_IPC_NS
> +	case CLONE_NEWIPC:
> +		VFS_WARN_ON_ONCE(ops != &ipcns_operations);
> +		break;
> +#endif
> +	case CLONE_NEWNS:
> +		VFS_WARN_ON_ONCE(ops != &mntns_operations);
> +		break;
> +#ifdef CONFIG_NET_NS
> +	case CLONE_NEWNET:
> +		VFS_WARN_ON_ONCE(ops != &netns_operations);
> +		break;
> +#endif
> +#ifdef CONFIG_PID_NS
> +	case CLONE_NEWPID:
> +		VFS_WARN_ON_ONCE(ops != &pidns_operations);
> +		break;
> +#endif
> +#ifdef CONFIG_TIME_NS
> +	case CLONE_NEWTIME:
> +		VFS_WARN_ON_ONCE(ops != &timens_operations);
> +		break;
> +#endif
> +#ifdef CONFIG_USER_NS
> +	case CLONE_NEWUSER:
> +		VFS_WARN_ON_ONCE(ops != &userns_operations);
> +		break;
> +#endif
> +#ifdef CONFIG_UTS_NS
> +	case CLONE_NEWUTS:
> +		VFS_WARN_ON_ONCE(ops != &utsns_operations);
> +		break;
> +#endif
> +	default:
> +		VFS_WARN_ON_ONCE(true);
> +	}
> +}
> +#endif
>  
>  int __ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops, int inum)
>  {
> @@ -12,6 +61,10 @@ int __ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
>  	RB_CLEAR_NODE(&ns->ns_tree_node);
>  	INIT_LIST_HEAD(&ns->ns_list_node);
>  
> +#ifdef CONFIG_DEBUG_VFS
> +	ns_debug(ns, ops);
> +#endif
> +
>  	if (inum) {
>  		ns->inum = inum;
>  		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