Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
33c42940
Commit
33c42940
authored
Nov 01, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy address of proc_ns_ops into ns_common
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
6344c433
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
34 additions
and
10 deletions
+34
-10
fs/namespace.c
fs/namespace.c
+1
-0
fs/proc/inode.c
fs/proc/inode.c
+2
-4
include/linux/ns_common.h
include/linux/ns_common.h
+3
-0
init/version.c
init/version.c
+3
-0
ipc/msgutil.c
ipc/msgutil.c
+3
-0
ipc/namespace.c
ipc/namespace.c
+1
-0
kernel/nsproxy.c
kernel/nsproxy.c
+4
-4
kernel/pid.c
kernel/pid.c
+3
-0
kernel/pid_namespace.c
kernel/pid_namespace.c
+1
-0
kernel/user.c
kernel/user.c
+3
-0
kernel/user_namespace.c
kernel/user_namespace.c
+1
-0
kernel/utsname.c
kernel/utsname.c
+2
-0
net/core/net_namespace.c
net/core/net_namespace.c
+7
-2
No files found.
fs/namespace.c
View file @
33c42940
...
...
@@ -2672,6 +2672,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns)
kfree
(
new_ns
);
return
ERR_PTR
(
ret
);
}
new_ns
->
ns
.
ops
=
&
mntns_operations
;
new_ns
->
seq
=
atomic64_add_return
(
1
,
&
mnt_ns_seq
);
atomic_set
(
&
new_ns
->
count
,
1
);
new_ns
->
root
=
NULL
;
...
...
fs/proc/inode.c
View file @
33c42940
...
...
@@ -32,7 +32,6 @@ static void proc_evict_inode(struct inode *inode)
{
struct
proc_dir_entry
*
de
;
struct
ctl_table_header
*
head
;
const
struct
proc_ns_operations
*
ns_ops
;
struct
ns_common
*
ns
;
truncate_inode_pages_final
(
&
inode
->
i_data
);
...
...
@@ -51,10 +50,9 @@ static void proc_evict_inode(struct inode *inode)
sysctl_head_put
(
head
);
}
/* Release any associated namespace */
ns_ops
=
PROC_I
(
inode
)
->
ns
.
ns_ops
;
ns
=
PROC_I
(
inode
)
->
ns
.
ns
;
if
(
ns
_ops
&&
n
s
)
ns
_
ops
->
put
(
ns
);
if
(
ns
&&
ns
->
op
s
)
ns
->
ops
->
put
(
ns
);
}
static
struct
kmem_cache
*
proc_inode_cachep
;
...
...
include/linux/ns_common.h
View file @
33c42940
#ifndef _LINUX_NS_COMMON_H
#define _LINUX_NS_COMMON_H
struct
proc_ns_operations
;
struct
ns_common
{
const
struct
proc_ns_operations
*
ops
;
unsigned
int
inum
;
};
...
...
init/version.c
View file @
33c42940
...
...
@@ -36,6 +36,9 @@ struct uts_namespace init_uts_ns = {
},
.
user_ns
=
&
init_user_ns
,
.
ns
.
inum
=
PROC_UTS_INIT_INO
,
#ifdef CONFIG_UTS_NS
.
ns
.
ops
=
&
utsns_operations
,
#endif
};
EXPORT_SYMBOL_GPL
(
init_uts_ns
);
...
...
ipc/msgutil.c
View file @
33c42940
...
...
@@ -32,6 +32,9 @@ struct ipc_namespace init_ipc_ns = {
.
count
=
ATOMIC_INIT
(
1
),
.
user_ns
=
&
init_user_ns
,
.
ns
.
inum
=
PROC_IPC_INIT_INO
,
#ifdef CONFIG_IPC_NS
.
ns
.
ops
=
&
ipcns_operations
,
#endif
};
atomic_t
nr_ipc_ns
=
ATOMIC_INIT
(
1
);
...
...
ipc/namespace.c
View file @
33c42940
...
...
@@ -31,6 +31,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
kfree
(
ns
);
return
ERR_PTR
(
err
);
}
ns
->
ns
.
ops
=
&
ipcns_operations
;
atomic_set
(
&
ns
->
count
,
1
);
err
=
mq_init_ns
(
ns
);
...
...
kernel/nsproxy.c
View file @
33c42940
...
...
@@ -220,11 +220,11 @@ void exit_task_namespaces(struct task_struct *p)
SYSCALL_DEFINE2
(
setns
,
int
,
fd
,
int
,
nstype
)
{
const
struct
proc_ns_operations
*
ops
;
struct
task_struct
*
tsk
=
current
;
struct
nsproxy
*
new_nsproxy
;
struct
proc_ns
*
ei
;
struct
file
*
file
;
struct
ns_common
*
ns
;
int
err
;
file
=
proc_ns_fget
(
fd
);
...
...
@@ -233,8 +233,8 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
err
=
-
EINVAL
;
ei
=
get_proc_ns
(
file_inode
(
file
));
ops
=
ei
->
ns_op
s
;
if
(
nstype
&&
(
ops
->
type
!=
nstype
))
ns
=
ei
->
n
s
;
if
(
nstype
&&
(
ns
->
ops
->
type
!=
nstype
))
goto
out
;
new_nsproxy
=
create_new_namespaces
(
0
,
tsk
,
current_user_ns
(),
tsk
->
fs
);
...
...
@@ -243,7 +243,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
goto
out
;
}
err
=
ops
->
install
(
new_nsproxy
,
ei
->
ns
);
err
=
ns
->
ops
->
install
(
new_nsproxy
,
ns
);
if
(
err
)
{
free_nsproxy
(
new_nsproxy
);
goto
out
;
...
...
kernel/pid.c
View file @
33c42940
...
...
@@ -80,6 +80,9 @@ struct pid_namespace init_pid_ns = {
.
child_reaper
=
&
init_task
,
.
user_ns
=
&
init_user_ns
,
.
ns
.
inum
=
PROC_PID_INIT_INO
,
#ifdef CONFIG_PID_NS
.
ns
.
ops
=
&
pidns_operations
,
#endif
};
EXPORT_SYMBOL_GPL
(
init_pid_ns
);
...
...
kernel/pid_namespace.c
View file @
33c42940
...
...
@@ -108,6 +108,7 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
err
=
ns_alloc_inum
(
&
ns
->
ns
);
if
(
err
)
goto
out_free_map
;
ns
->
ns
.
ops
=
&
pidns_operations
;
kref_init
(
&
ns
->
kref
);
ns
->
level
=
level
;
...
...
kernel/user.c
View file @
33c42940
...
...
@@ -51,6 +51,9 @@ struct user_namespace init_user_ns = {
.
owner
=
GLOBAL_ROOT_UID
,
.
group
=
GLOBAL_ROOT_GID
,
.
ns
.
inum
=
PROC_USER_INIT_INO
,
#ifdef CONFIG_USER_NS
.
ns
.
ops
=
&
userns_operations
,
#endif
#ifdef CONFIG_PERSISTENT_KEYRINGS
.
persistent_keyring_register_sem
=
__RWSEM_INITIALIZER
(
init_user_ns
.
persistent_keyring_register_sem
),
...
...
kernel/user_namespace.c
View file @
33c42940
...
...
@@ -91,6 +91,7 @@ int create_user_ns(struct cred *new)
kmem_cache_free
(
user_ns_cachep
,
ns
);
return
ret
;
}
ns
->
ns
.
ops
=
&
userns_operations
;
atomic_set
(
&
ns
->
count
,
1
);
/* Leave the new->user_ns reference with the new user namespace. */
...
...
kernel/utsname.c
View file @
33c42940
...
...
@@ -48,6 +48,8 @@ static struct uts_namespace *clone_uts_ns(struct user_namespace *user_ns,
return
ERR_PTR
(
err
);
}
ns
->
ns
.
ops
=
&
utsns_operations
;
down_read
(
&
uts_sem
);
memcpy
(
&
ns
->
name
,
&
old_ns
->
name
,
sizeof
(
ns
->
name
));
ns
->
user_ns
=
get_user_ns
(
user_ns
);
...
...
net/core/net_namespace.c
View file @
33c42940
...
...
@@ -339,6 +339,7 @@ struct net *get_net_ns_by_fd(int fd)
{
struct
proc_ns
*
ei
;
struct
file
*
file
;
struct
ns_common
*
ns
;
struct
net
*
net
;
file
=
proc_ns_fget
(
fd
);
...
...
@@ -346,8 +347,9 @@ struct net *get_net_ns_by_fd(int fd)
return
ERR_CAST
(
file
);
ei
=
get_proc_ns
(
file_inode
(
file
));
if
(
ei
->
ns_ops
==
&
netns_operations
)
net
=
get_net
(
container_of
(
ei
->
ns
,
struct
net
,
ns
));
ns
=
ei
->
ns
;
if
(
ns
->
ops
==
&
netns_operations
)
net
=
get_net
(
container_of
(
ns
,
struct
net
,
ns
));
else
net
=
ERR_PTR
(
-
EINVAL
);
...
...
@@ -386,6 +388,9 @@ EXPORT_SYMBOL_GPL(get_net_ns_by_pid);
static
__net_init
int
net_ns_net_init
(
struct
net
*
net
)
{
#ifdef CONFIG_NET_NS
net
->
ns
.
ops
=
&
netns_operations
;
#endif
return
ns_alloc_inum
(
&
net
->
ns
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment