Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
user_namespace.c File Reference
#include <linux/export.h>
#include <linux/nsproxy.h>
#include <linux/slab.h>
#include <linux/user_namespace.h>
#include <linux/highuid.h>
#include <linux/cred.h>
#include <linux/securebits.h>
#include <linux/keyctl.h>
#include <linux/key-type.h>
#include <keys/user-type.h>
#include <linux/seq_file.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/ctype.h>
#include <linux/projid.h>

Go to the source code of this file.

Functions

int create_user_ns (struct cred *new)
 
void free_user_ns (struct kref *kref)
 
 EXPORT_SYMBOL (free_user_ns)
 
kuid_t make_kuid (struct user_namespace *ns, uid_t uid)
 
 EXPORT_SYMBOL (make_kuid)
 
uid_t from_kuid (struct user_namespace *targ, kuid_t kuid)
 
 EXPORT_SYMBOL (from_kuid)
 
uid_t from_kuid_munged (struct user_namespace *targ, kuid_t kuid)
 
 EXPORT_SYMBOL (from_kuid_munged)
 
kgid_t make_kgid (struct user_namespace *ns, gid_t gid)
 
 EXPORT_SYMBOL (make_kgid)
 
gid_t from_kgid (struct user_namespace *targ, kgid_t kgid)
 
 EXPORT_SYMBOL (from_kgid)
 
gid_t from_kgid_munged (struct user_namespace *targ, kgid_t kgid)
 
 EXPORT_SYMBOL (from_kgid_munged)
 
kprojid_t make_kprojid (struct user_namespace *ns, projid_t projid)
 
 EXPORT_SYMBOL (make_kprojid)
 
projid_t from_kprojid (struct user_namespace *targ, kprojid_t kprojid)
 
 EXPORT_SYMBOL (from_kprojid)
 
projid_t from_kprojid_munged (struct user_namespace *targ, kprojid_t kprojid)
 
 EXPORT_SYMBOL (from_kprojid_munged)
 
ssize_t proc_uid_map_write (struct file *file, const char __user *buf, size_t size, loff_t *ppos)
 
ssize_t proc_gid_map_write (struct file *file, const char __user *buf, size_t size, loff_t *ppos)
 
ssize_t proc_projid_map_write (struct file *file, const char __user *buf, size_t size, loff_t *ppos)
 
 module_init (user_namespaces_init)
 

Variables

struct seq_operations proc_uid_seq_operations
 
struct seq_operations proc_gid_seq_operations
 
struct seq_operations proc_projid_seq_operations
 

Function Documentation

int create_user_ns ( struct cred new)

Definition at line 37 of file user_namespace.c.

EXPORT_SYMBOL ( free_user_ns  )
EXPORT_SYMBOL ( make_kuid  )
EXPORT_SYMBOL ( from_kuid  )
EXPORT_SYMBOL ( from_kuid_munged  )
EXPORT_SYMBOL ( make_kgid  )
EXPORT_SYMBOL ( from_kgid  )
EXPORT_SYMBOL ( from_kgid_munged  )
EXPORT_SYMBOL ( make_kprojid  )
EXPORT_SYMBOL ( from_kprojid  )
EXPORT_SYMBOL ( from_kprojid_munged  )
void free_user_ns ( struct kref kref)

Definition at line 81 of file user_namespace.c.

gid_t from_kgid ( struct user_namespace targ,
kgid_t  kgid 
)

from_kgid - Create a gid from a kgid user-namespace pair. : The user namespace we want a gid in. : The kernel internal gid to start with.

Map into the user-namespace specified by and return the resulting gid.

There is always a mapping into the initial user_namespace.

If has no mapping in (gid_t)-1 is returned.

Definition at line 264 of file user_namespace.c.

gid_t from_kgid_munged ( struct user_namespace targ,
kgid_t  kgid 
)

from_kgid_munged - Create a gid from a kgid user-namespace pair. : The user namespace we want a gid in. : The kernel internal gid to start with.

Map into the user-namespace specified by and return the resulting gid.

There is always a mapping into the initial user_namespace.

Unlike from_kgid from_kgid_munged never fails and always returns a valid gid. This makes from_kgid_munged appropriate for use in syscalls like stat and getgid where failing the system call and failing to provide a valid gid are not options.

If has no mapping in overflowgid is returned.

Definition at line 288 of file user_namespace.c.

projid_t from_kprojid ( struct user_namespace targ,
kprojid_t  kprojid 
)

from_kprojid - Create a projid from a kprojid user-namespace pair. : The user namespace we want a projid in. : The kernel internal project identifier to start with.

Map into the user-namespace specified by and return the resulting projid.

There is always a mapping into the initial user_namespace.

If has no mapping in (projid_t)-1 is returned.

Definition at line 331 of file user_namespace.c.

projid_t from_kprojid_munged ( struct user_namespace targ,
kprojid_t  kprojid 
)

from_kprojid_munged - Create a projiid from a kprojid user-namespace pair. : The user namespace we want a projid in. : The kernel internal projid to start with.

Map into the user-namespace specified by and return the resulting projid.

There is always a mapping into the initial user_namespace.

Unlike from_kprojid from_kprojid_munged never fails and always returns a valid projid. This makes from_kprojid_munged appropriate for use in syscalls like stat and where failing the system call and failing to provide a valid projid are not an options.

If has no mapping in OVERFLOW_PROJID is returned.

Definition at line 356 of file user_namespace.c.

uid_t from_kuid ( struct user_namespace targ,
kuid_t  kuid 
)

from_kuid - Create a uid from a kuid user-namespace pair. : The user namespace we want a uid in. : The kernel internal uid to start with.

Map into the user-namespace specified by and return the resulting uid.

There is always a mapping into the initial user_namespace.

If has no mapping in (uid_t)-1 is returned.

Definition at line 196 of file user_namespace.c.

uid_t from_kuid_munged ( struct user_namespace targ,
kuid_t  kuid 
)

from_kuid_munged - Create a uid from a kuid user-namespace pair. : The user namespace we want a uid in. : The kernel internal uid to start with.

Map into the user-namespace specified by and return the resulting uid.

There is always a mapping into the initial user_namespace.

Unlike from_kuid from_kuid_munged never fails and always returns a valid uid. This makes from_kuid_munged appropriate for use in syscalls like stat and getuid where failing the system call and failing to provide a valid uid are not an options.

If has no mapping in overflowuid is returned.

Definition at line 221 of file user_namespace.c.

kgid_t make_kgid ( struct user_namespace ns,
gid_t  gid 
)

make_kgid - Map a user-namespace gid pair into a kgid. : User namespace that the gid is in : group identifier

Maps a user-namespace gid pair into a kernel internal kgid, and returns that kgid.

When there is no mapping defined for the user-namespace gid pair INVALID_GID is returned. Callers are expected to test for and handle INVALID_GID being returned. INVALID_GID may be tested for using gid_valid().

Definition at line 245 of file user_namespace.c.

kprojid_t make_kprojid ( struct user_namespace ns,
projid_t  projid 
)

make_kprojid - Map a user-namespace projid pair into a kprojid. : User namespace that the projid is in : Project identifier

Maps a user-namespace uid pair into a kernel internal kuid, and returns that kuid.

When there is no mapping defined for the user-namespace projid pair INVALID_PROJID is returned. Callers are expected to test for and handle handle INVALID_PROJID being returned. INVALID_PROJID may be tested for using projid_valid().

Definition at line 312 of file user_namespace.c.

kuid_t make_kuid ( struct user_namespace ns,
uid_t  uid 
)

make_kuid - Map a user-namespace uid pair into a kuid. : User namespace that the uid is in : User identifier

Maps a user-namespace uid pair into a kernel internal kuid, and returns that kuid.

When there is no mapping defined for the user-namespace uid pair INVALID_UID is returned. Callers are expected to test for and handle handle INVALID_UID being returned. INVALID_UID may be tested for using uid_valid().

Definition at line 177 of file user_namespace.c.

module_init ( user_namespaces_init  )
ssize_t proc_gid_map_write ( struct file file,
const char __user buf,
size_t  size,
loff_t *  ppos 
)

Definition at line 680 of file user_namespace.c.

ssize_t proc_projid_map_write ( struct file file,
const char __user buf,
size_t  size,
loff_t *  ppos 
)

Definition at line 692 of file user_namespace.c.

ssize_t proc_uid_map_write ( struct file file,
const char __user buf,
size_t  size,
loff_t *  ppos 
)

Definition at line 668 of file user_namespace.c.

Variable Documentation

struct seq_operations proc_gid_seq_operations
Initial value:
= {
.start = gid_m_start,
.stop = m_stop,
.next = m_next,
.show = gid_m_show,
}

Definition at line 481 of file user_namespace.c.

struct seq_operations proc_projid_seq_operations
Initial value:
= {
.start = projid_m_start,
.stop = m_stop,
.next = m_next,
.show = projid_m_show,
}

Definition at line 488 of file user_namespace.c.

struct seq_operations proc_uid_seq_operations
Initial value:
= {
.start = uid_m_start,
.stop = m_stop,
.next = m_next,
.show = uid_m_show,
}

Definition at line 474 of file user_namespace.c.