#include <linux/export.h>
#include <linux/utsname.h>
#include <linux/user_namespace.h>
#include <linux/proc_ns.h>
#include <linux/sched/task.h>
static struct kmem_cache *uts_ns_cache __ro_after_init;
static struct ucounts *inc_uts_namespaces(struct user_namespace *ns)
return inc_ucount(ns, current_euid(), UCOUNT_UTS_NAMESPACES);
static void dec_uts_namespaces(struct ucounts *ucounts)
dec_ucount(ucounts, UCOUNT_UTS_NAMESPACES);
static struct uts_namespace *create_uts_ns(void)
struct uts_namespace *uts_ns;
uts_ns = kmem_cache_alloc(uts_ns_cache, GFP_KERNEL);
kref_init(&uts_ns->kref);
static struct uts_namespace *clone_uts_ns(struct user_namespace *user_ns,
struct uts_namespace *old_ns)
struct uts_namespace *ns;
ucounts = inc_uts_namespaces(user_ns);