Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] setns.2: fix CLONE_NEWNS restriction info
@ 2019-09-19  5:43 Mike Frysinger
  2019-09-19  6:38 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2019-09-19  5:43 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-man

Threads are allowed to switch mount namespaces if the filesystem
details aren't being shared.  That's the purpose of the check in
the kernel quoted by the comment:
    if (fs->users != 1)
        return -EINVAL;

It's been this way since the code was originally merged in v3.8.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 man2/setns.2 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/man2/setns.2 b/man2/setns.2
index 18e80202326a..5985c099b464 100644
--- a/man2/setns.2
+++ b/man2/setns.2
@@ -131,8 +131,12 @@ capabilities in its own user namespace and
 .BR CAP_SYS_ADMIN
 in the user namespace that owns the target mount namespace.
 .IP
-A process may not be reassociated with a new mount namespace if it is
-multithreaded.
+A process can't join a new mount namespace if it is sharing
+filesystem-related attributes
+(the attributes whose sharing is controlled by the
+.BR clone (2)
+.B CLONE_FS
+flag) with another process.
 .\" Above check is in fs/namespace.c:mntns_install() [3.8 source]
 .IP
 See
-- 
2.23.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] setns.2: fix CLONE_NEWNS restriction info
  2019-09-19  5:43 [PATCH] setns.2: fix CLONE_NEWNS restriction info Mike Frysinger
@ 2019-09-19  6:38 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-09-19  6:38 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: mtk.manpages, linux-man

Hello Mike,

On 9/19/19 7:43 AM, Mike Frysinger wrote:
> Threads are allowed to switch mount namespaces if the filesystem
> details aren't being shared.  That's the purpose of the check in
> the kernel quoted by the comment:
>     if (fs->users != 1)
>         return -EINVAL;
> 
> It's been this way since the code was originally merged in v3.8.

Thanks. Patch applied.

Cheers,

Michael

> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  man2/setns.2 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/setns.2 b/man2/setns.2
> index 18e80202326a..5985c099b464 100644
> --- a/man2/setns.2
> +++ b/man2/setns.2
> @@ -131,8 +131,12 @@ capabilities in its own user namespace and
>  .BR CAP_SYS_ADMIN
>  in the user namespace that owns the target mount namespace.
>  .IP
> -A process may not be reassociated with a new mount namespace if it is
> -multithreaded.
> +A process can't join a new mount namespace if it is sharing
> +filesystem-related attributes
> +(the attributes whose sharing is controlled by the
> +.BR clone (2)
> +.B CLONE_FS
> +flag) with another process.
>  .\" Above check is in fs/namespace.c:mntns_install() [3.8 source]
>  .IP
>  See
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-19  5:43 [PATCH] setns.2: fix CLONE_NEWNS restriction info Mike Frysinger
2019-09-19  6:38 ` Michael Kerrisk (man-pages)

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org linux-man@archiver.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/ public-inbox