Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\nsproxy.c Create Date:2022-07-28 09:31:27
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Create new nsproxy and all of its the associated namespaces.* Return the newly created nsproxy. Do not attach this to the task,* leave it to the caller to do proper locking and attach it to task.

Proto:static struct nsproxy *create_new_namespaces(unsigned long flags, struct task_struct *tsk, struct user_namespace *user_ns, struct fs_struct *new_fs)

Type:struct nsproxy

Parameter:

TypeParameterName
unsigned longflags
struct task_struct *tsk
struct user_namespace *user_ns
struct fs_struct *new_fs
67  new_nsp = create_nsproxy()
68  If Not new_nsp Then Return ERR_PTR( - ENOMEM)
71  mnt_ns = copy_mnt_ns(flags, mnt_ns, user_ns, new_fs)
72  If IS_ERR(mnt_ns) Then
73  err = PTR_ERR(mnt_ns)
74  Go to out_ns
77  uts_ns = copy_utsname(flags, user_ns, uts_ns)
78  If IS_ERR(uts_ns) Then
79  err = PTR_ERR(uts_ns)
80  Go to out_uts
83  ipc_ns = copy_ipcs(flags, user_ns, ipc_ns)
84  If IS_ERR(ipc_ns) Then
85  err = PTR_ERR(ipc_ns)
86  Go to out_ipc
89  pid_ns_for_children = copy_pid_ns(flags, user_ns, pid_ns_for_children)
91  If IS_ERR(pid_ns_for_children) Then
92  err = PTR_ERR(pid_ns_for_children)
93  Go to out_pid
96  cgroup_ns = copy_cgroup_ns(flags, user_ns, cgroup_ns)
98  If IS_ERR(cgroup_ns) Then
99  err = PTR_ERR(cgroup_ns)
100  Go to out_cgroup
103  net_ns = copy_net_ns(flags, user_ns, net_ns)
104  If IS_ERR(net_ns) Then
105  err = PTR_ERR(net_ns)
106  Go to out_net
109  Return new_nsp
111  out_net :
112  put_cgroup_ns(cgroup_ns)
113  out_cgroup :
114  If pid_ns_for_children Then put_pid_ns(pid_ns_for_children)
116  out_pid :
117  If ipc_ns Then put_ipc_ns(ipc_ns)
119  out_ipc :
120  If uts_ns Then put_uts_ns(uts_ns)
122  out_uts :
123  If mnt_ns Then put_mnt_ns(mnt_ns)
125  out_ns :
126  Deallocate an object
127  Return ERR_PTR(err)
Caller
NameDescribe
copy_namespacesThis now handles copy for nsproxy and all namespaces therein
unshare_nsproxy_namespacesCalled from unshare. Unshare all the namespaces part of nsproxy.* On success, returns the new nsproxy.
SYSCALL_DEFINE2