summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2020-07-06 17:49:11 +0200
committerChristian Brauner <christian.brauner@ubuntu.com>2020-07-08 11:14:22 +0200
commit76c12881a38aaa83e1eb4ce2fada36c3a732bad4 (patch)
tree3319e14107ff7c152cd5400902a771273cd21ff2 /kernel/time
parenttimens: add timens_commit() helper (diff)
downloadlinux-76c12881a38aaa83e1eb4ce2fada36c3a732bad4.tar.xz
linux-76c12881a38aaa83e1eb4ce2fada36c3a732bad4.zip
nsproxy: support CLONE_NEWTIME with setns()
So far setns() was missing time namespace support. This was partially due to it simply not being implemented but also because vdso_join_timens() could still fail which made switching to multiple namespaces atomically problematic. This is now fixed so support CLONE_NEWTIME with setns() Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Reviewed-by: Andrei Vagin <avagin@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Serge Hallyn <serge@hallyn.com> Cc: Dmitry Safonov <dima@arista.com> Link: https://lore.kernel.org/r/20200706154912.3248030-4-christian.brauner@ubuntu.com
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/namespace.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index aa7b90aac2a7..afc65e6be33e 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -280,7 +280,7 @@ static void timens_put(struct ns_common *ns)
put_time_ns(to_time_ns(ns));
}
-static void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
+void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
{
timens_set_vvar_page(tsk, ns);
vdso_join_timens(tsk, ns);
@@ -298,9 +298,6 @@ static int timens_install(struct nsset *nsset, struct ns_common *new)
!ns_capable(nsset->cred->user_ns, CAP_SYS_ADMIN))
return -EPERM;
-
- timens_commit(current, ns);
-
get_time_ns(ns);
put_time_ns(nsproxy->time_ns);
nsproxy->time_ns = ns;