Lines Matching refs: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_ACCOUNT); in clone_time_ns()
92 if (!ns) in clone_time_ns()
95 refcount_set(&ns->ns.count, 1); in clone_time_ns()
97 ns->vvar_page = alloc_page(GFP_KERNEL_ACCOUNT | __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()
229 void free_time_ns(struct time_namespace *ns) in free_time_ns() argument
231 dec_time_namespaces(ns->ucounts); in free_time_ns()
232 put_user_ns(ns->user_ns); in free_time_ns()
233 ns_free_inum(&ns->ns); in free_time_ns()
234 __free_page(ns->vvar_page); in free_time_ns()
235 kfree(ns); in free_time_ns()
238 static struct time_namespace *to_time_ns(struct ns_common *ns) in to_time_ns() argument
240 return container_of(ns, struct time_namespace, ns); in to_time_ns()
245 struct time_namespace *ns = NULL; in timens_get() local
251 ns = nsproxy->time_ns; in timens_get()
252 get_time_ns(ns); in timens_get()
256 return ns ? &ns->ns : NULL; in timens_get()
261 struct time_namespace *ns = NULL; in timens_for_children_get() local
267 ns = nsproxy->time_ns_for_children; in timens_for_children_get()
268 get_time_ns(ns); in timens_for_children_get()
272 return ns ? &ns->ns : NULL; in timens_for_children_get()
275 static void timens_put(struct ns_common *ns) in timens_put() argument
277 put_time_ns(to_time_ns(ns)); in timens_put()
280 void timens_commit(struct task_struct *tsk, struct time_namespace *ns) in timens_commit() argument
282 timens_set_vvar_page(tsk, ns); in timens_commit()
283 vdso_join_timens(tsk, ns); in timens_commit()
289 struct time_namespace *ns = to_time_ns(new); in timens_install() local
294 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || in timens_install()
298 get_time_ns(ns); in timens_install()
300 nsproxy->time_ns = ns; in timens_install()
302 get_time_ns(ns); in timens_install()
304 nsproxy->time_ns_for_children = ns; in timens_install()
310 struct ns_common *nsc = &nsproxy->time_ns_for_children->ns; in timens_on_fork()
311 struct time_namespace *ns = to_time_ns(nsc); in timens_on_fork() local
317 get_time_ns(ns); in timens_on_fork()
319 nsproxy->time_ns = ns; in timens_on_fork()
321 timens_commit(tsk, ns); in timens_on_fork()
324 static struct user_namespace *timens_owner(struct ns_common *ns) in timens_owner() argument
326 return to_time_ns(ns)->user_ns; in timens_owner()
349 struct ns_common *ns; in proc_timens_show_offsets() local
352 ns = timens_for_children_get(p); in proc_timens_show_offsets()
353 if (!ns) in proc_timens_show_offsets()
355 time_ns = to_time_ns(ns); in proc_timens_show_offsets()
365 struct ns_common *ns; in proc_timens_set_offset() local
370 ns = timens_for_children_get(p); in proc_timens_set_offset()
371 if (!ns) in proc_timens_set_offset()
373 time_ns = to_time_ns(ns); in proc_timens_set_offset()
462 .ns.count = REFCOUNT_INIT(3),
464 .ns.inum = PROC_TIME_INIT_INO,
465 .ns.ops = &timens_operations,