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: <oqtggwqink4kthsxiv6tv6q6l7tgykosz3tenek2vejqfiuqzl@drczxzwwucfi>
Date: Wed, 17 Sep 2025 18:28:37 +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 2/9] mnt: expose pointer to init_mnt_ns

On Wed 17-09-25 12:28:01, Christian Brauner wrote:
> There's various scenarios where we need to know whether we are in the
> initial set of namespaces or not to e.g., shortcut permission checking.
> All namespaces expose that information. Let's do that too.
> 
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Right. Feel free to add:

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

								Honza

> ---
>  fs/namespace.c                | 2 ++
>  include/linux/mnt_namespace.h | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index a68998449698..c8251545d57e 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -81,6 +81,7 @@ static DECLARE_RWSEM(namespace_sem);
>  static HLIST_HEAD(unmounted);	/* protected by namespace_sem */
>  static LIST_HEAD(ex_mountpoints); /* protected by namespace_sem */
>  static struct mnt_namespace *emptied_ns; /* protected by namespace_sem */
> +struct mnt_namespace *init_mnt_ns;
>  
>  #ifdef CONFIG_FSNOTIFY
>  LIST_HEAD(notify_list); /* protected by namespace_sem */
> @@ -6037,6 +6038,7 @@ static void __init init_mount_tree(void)
>  	set_fs_root(current->fs, &root);
>  
>  	ns_tree_add(ns);
> +	init_mnt_ns = ns;
>  }
>  
>  void __init mnt_init(void)
> diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
> index 70b366b64816..7e23c8364a9c 100644
> --- a/include/linux/mnt_namespace.h
> +++ b/include/linux/mnt_namespace.h
> @@ -11,6 +11,8 @@ struct fs_struct;
>  struct user_namespace;
>  struct ns_common;
>  
> +extern struct mnt_namespace *init_mnt_ns;
> +
>  extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
>  		struct user_namespace *, struct fs_struct *);
>  extern void put_mnt_ns(struct mnt_namespace *ns);
> 
> -- 
> 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