[PATCH] fork.c: Add doc about usage of CLONE_FS flags and namespaces

From: Marcos Paulo de Souza
Date: Sun Nov 12 2017 - 10:19:11 EST


All other places that deals with namespaces have an explanation of why
the restriction is there. The description added in this commit was based
in e66eded8309eb.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
---
kernel/fork.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/fork.c b/kernel/fork.c
index 07cc743698d3..29cb72b64900 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1549,6 +1549,10 @@ static __latent_entropy struct task_struct *copy_process(
int retval;
struct task_struct *p;

+ /*
+ * Don't allow sharing the root directory with processes in a different
+ * namespace
+ */
if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
return ERR_PTR(-EINVAL);

--
2.13.6