Lines Matching full:ns
59 static struct ucounts *inc_time_namespaces(struct user_namespace *ns) in inc_time_namespaces() argument
61 return inc_ucount(ns, current_euid(), UCOUNT_TIME_NAMESPACES); in inc_time_namespaces()
81 struct time_namespace *ns; in clone_time_ns() local
91 ns = kmalloc(sizeof(*ns), GFP_KERNEL); in clone_time_ns()
92 if (!ns) in clone_time_ns()
95 kref_init(&ns->kref); in clone_time_ns()
97 ns->vvar_page = alloc_page(GFP_KERNEL | __GFP_ZERO); in clone_time_ns()
98 if (!ns->vvar_page) in clone_time_ns()
101 err = ns_alloc_inum(&ns->ns); in clone_time_ns()
105 ns->ucounts = ucounts; in clone_time_ns()
106 ns->ns.ops = &timens_operations; in clone_time_ns()
107 ns->user_ns = get_user_ns(user_ns); in clone_time_ns()
108 ns->offsets = old_ns->offsets; in clone_time_ns()
109 ns->frozen_offsets = false; in clone_time_ns()
110 return ns; in clone_time_ns()
113 __free_page(ns->vvar_page); in clone_time_ns()
115 kfree(ns); in clone_time_ns()
180 struct time_namespace *ns) in timens_setup_vdso_data() argument
183 struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic); in timens_setup_vdso_data()
184 struct timens_offset boottime = offset_from_ts(ns->offsets.boottime); in timens_setup_vdso_data()
202 struct time_namespace *ns) in timens_set_vvar_page() argument
207 if (ns == &init_time_ns) in timens_set_vvar_page()
211 if (likely(ns->frozen_offsets)) in timens_set_vvar_page()
216 if (ns->frozen_offsets) in timens_set_vvar_page()
219 ns->frozen_offsets = true; in timens_set_vvar_page()
220 vdata = arch_get_vdso_data(page_address(ns->vvar_page)); in timens_set_vvar_page()
223 timens_setup_vdso_data(&vdata[i], ns); in timens_set_vvar_page()
231 struct time_namespace *ns; in free_time_ns() local
233 ns = container_of(kref, struct time_namespace, kref); in free_time_ns()
234 dec_time_namespaces(ns->ucounts); in free_time_ns()
235 put_user_ns(ns->user_ns); in free_time_ns()
236 ns_free_inum(&ns->ns); in free_time_ns()
237 __free_page(ns->vvar_page); in free_time_ns()
238 kfree(ns); in free_time_ns()
241 static struct time_namespace *to_time_ns(struct ns_common *ns) in to_time_ns() argument
243 return container_of(ns, struct time_namespace, ns); in to_time_ns()
248 struct time_namespace *ns = NULL; in timens_get() local
254 ns = nsproxy->time_ns; in timens_get()
255 get_time_ns(ns); in timens_get()
259 return ns ? &ns->ns : NULL; in timens_get()
264 struct time_namespace *ns = NULL; in timens_for_children_get() local
270 ns = nsproxy->time_ns_for_children; in timens_for_children_get()
271 get_time_ns(ns); in timens_for_children_get()
275 return ns ? &ns->ns : NULL; in timens_for_children_get()
278 static void timens_put(struct ns_common *ns) in timens_put() argument
280 put_time_ns(to_time_ns(ns)); in timens_put()
283 void timens_commit(struct task_struct *tsk, struct time_namespace *ns) in timens_commit() argument
285 timens_set_vvar_page(tsk, ns); in timens_commit()
286 vdso_join_timens(tsk, ns); in timens_commit()
292 struct time_namespace *ns = to_time_ns(new); in timens_install() local
297 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || in timens_install()
301 get_time_ns(ns); in timens_install()
303 nsproxy->time_ns = ns; in timens_install()
305 get_time_ns(ns); in timens_install()
307 nsproxy->time_ns_for_children = ns; in timens_install()
313 struct ns_common *nsc = &nsproxy->time_ns_for_children->ns; in timens_on_fork()
314 struct time_namespace *ns = to_time_ns(nsc); in timens_on_fork() local
320 get_time_ns(ns); in timens_on_fork()
322 nsproxy->time_ns = ns; in timens_on_fork()
324 timens_commit(tsk, ns); in timens_on_fork()
329 static struct user_namespace *timens_owner(struct ns_common *ns) in timens_owner() argument
331 return to_time_ns(ns)->user_ns; in timens_owner()
354 struct ns_common *ns; in proc_timens_show_offsets() local
357 ns = timens_for_children_get(p); in proc_timens_show_offsets()
358 if (!ns) in proc_timens_show_offsets()
360 time_ns = to_time_ns(ns); in proc_timens_show_offsets()
370 struct ns_common *ns; in proc_timens_set_offset() local
375 ns = timens_for_children_get(p); in proc_timens_set_offset()
376 if (!ns) in proc_timens_set_offset()
378 time_ns = to_time_ns(ns); in proc_timens_set_offset()
469 .ns.inum = PROC_TIME_INIT_INO,
470 .ns.ops = &timens_operations,