File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ static const struct proc_ns_operations *ns_entries[] = {
2222#ifdef CONFIG_UTS_NS
2323 & utsns_operations ,
2424#endif
25+ #ifdef CONFIG_IPC_NS
26+ & ipcns_operations ,
27+ #endif
2528};
2629
2730static const struct file_operations ns_file_operations = {
Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ struct proc_ns_operations {
267267};
268268extern const struct proc_ns_operations netns_operations ;
269269extern const struct proc_ns_operations utsns_operations ;
270+ extern const struct proc_ns_operations ipcns_operations ;
270271
271272union proc_op {
272273 int (* proc_get_link )(struct inode * , struct path * );
Original file line number Diff line number Diff line change 1212#include <linux/fs.h>
1313#include <linux/mount.h>
1414#include <linux/user_namespace.h>
15+ #include <linux/proc_fs.h>
1516
1617#include "util.h"
1718
@@ -140,3 +141,39 @@ void put_ipc_ns(struct ipc_namespace *ns)
140141 free_ipc_ns (ns );
141142 }
142143}
144+
145+ static void * ipcns_get (struct task_struct * task )
146+ {
147+ struct ipc_namespace * ns = NULL ;
148+ struct nsproxy * nsproxy ;
149+
150+ rcu_read_lock ();
151+ nsproxy = task_nsproxy (task );
152+ if (nsproxy )
153+ ns = get_ipc_ns (nsproxy -> ipc_ns );
154+ rcu_read_unlock ();
155+
156+ return ns ;
157+ }
158+
159+ static void ipcns_put (void * ns )
160+ {
161+ return put_ipc_ns (ns );
162+ }
163+
164+ static int ipcns_install (struct nsproxy * nsproxy , void * ns )
165+ {
166+ /* Ditch state from the old ipc namespace */
167+ exit_sem (current );
168+ put_ipc_ns (nsproxy -> ipc_ns );
169+ nsproxy -> ipc_ns = get_ipc_ns (ns );
170+ return 0 ;
171+ }
172+
173+ const struct proc_ns_operations ipcns_operations = {
174+ .name = "ipc" ,
175+ .type = CLONE_NEWIPC ,
176+ .get = ipcns_get ,
177+ .put = ipcns_put ,
178+ .install = ipcns_install ,
179+ };
You can’t perform that action at this time.
0 commit comments