aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Le Goater <clg@fr.ibm.com>2007-07-16 02:40:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:47 -0400
commit7d69a1f4a72b18876c99c697692b78339d491568 (patch)
treec09faf07f15240592919ec7e3dd722fe4f1dd370
parent522ed7767e800cff6c650ec64b0ee0677303119c (diff)
remove CONFIG_UTS_NS and CONFIG_IPC_NS
CONFIG_UTS_NS and CONFIG_IPC_NS have very little value as they only deactivate the unshare of the uts and ipc namespaces and do not improve performance. Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Acked-by: "Serge E. Hallyn" <serue@us.ibm.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/ipc.h11
-rw-r--r--include/linux/utsname.h13
-rw-r--r--init/Kconfig17
-rw-r--r--ipc/msg.c4
-rw-r--r--ipc/sem.c4
-rw-r--r--ipc/shm.c4
-rw-r--r--ipc/util.c11
-rw-r--r--ipc/util.h8
-rw-r--r--kernel/Makefile4
-rw-r--r--kernel/nsproxy.c10
-rw-r--r--kernel/utsname_sysctl.c5
11 files changed, 12 insertions, 79 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 7c8c6d8d090c..3fd3ddd5f0d9 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -93,6 +93,7 @@ extern struct ipc_namespace init_ipc_ns;
93 93
94#ifdef CONFIG_SYSVIPC 94#ifdef CONFIG_SYSVIPC
95#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 95#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
96extern void free_ipc_ns(struct kref *kref);
96extern struct ipc_namespace *copy_ipcs(unsigned long flags, 97extern struct ipc_namespace *copy_ipcs(unsigned long flags,
97 struct ipc_namespace *ns); 98 struct ipc_namespace *ns);
98#else 99#else
@@ -104,13 +105,9 @@ static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
104} 105}
105#endif 106#endif
106 107
107#ifdef CONFIG_IPC_NS
108extern void free_ipc_ns(struct kref *kref);
109#endif
110
111static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 108static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
112{ 109{
113#ifdef CONFIG_IPC_NS 110#ifdef CONFIG_SYSVIPC
114 if (ns) 111 if (ns)
115 kref_get(&ns->kref); 112 kref_get(&ns->kref);
116#endif 113#endif
@@ -119,7 +116,7 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
119 116
120static inline void put_ipc_ns(struct ipc_namespace *ns) 117static inline void put_ipc_ns(struct ipc_namespace *ns)
121{ 118{
122#ifdef CONFIG_IPC_NS 119#ifdef CONFIG_SYSVIPC
123 kref_put(&ns->kref, free_ipc_ns); 120 kref_put(&ns->kref, free_ipc_ns);
124#endif 121#endif
125} 122}
@@ -127,5 +124,3 @@ static inline void put_ipc_ns(struct ipc_namespace *ns)
127#endif /* __KERNEL__ */ 124#endif /* __KERNEL__ */
128 125
129#endif /* _LINUX_IPC_H */ 126#endif /* _LINUX_IPC_H */
130
131
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index f8d3b326e93a..51ad167611e4 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -48,7 +48,6 @@ static inline void get_uts_ns(struct uts_namespace *ns)
48 kref_get(&ns->kref); 48 kref_get(&ns->kref);
49} 49}
50 50
51#ifdef CONFIG_UTS_NS
52extern struct uts_namespace *copy_utsname(int flags, struct uts_namespace *ns); 51extern struct uts_namespace *copy_utsname(int flags, struct uts_namespace *ns);
53extern void free_uts_ns(struct kref *kref); 52extern void free_uts_ns(struct kref *kref);
54 53
@@ -56,18 +55,6 @@ static inline void put_uts_ns(struct uts_namespace *ns)
56{ 55{
57 kref_put(&ns->kref, free_uts_ns); 56 kref_put(&ns->kref, free_uts_ns);
58} 57}
59#else
60static inline struct uts_namespace *copy_utsname(int flags,
61 struct uts_namespace *ns)
62{
63 return ns;
64}
65
66static inline void put_uts_ns(struct uts_namespace *ns)
67{
68}
69#endif
70
71static inline struct new_utsname *utsname(void) 58static inline struct new_utsname *utsname(void)
72{ 59{
73 return &current->nsproxy->uts_ns->name; 60 return &current->nsproxy->uts_ns->name;
diff --git a/init/Kconfig b/init/Kconfig
index 73e91983760f..1e198b8c6936 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -120,15 +120,6 @@ config SYSVIPC
120 section 6.4 of the Linux Programmer's Guide, available from 120 section 6.4 of the Linux Programmer's Guide, available from
121 <http://www.tldp.org/guides.html>. 121 <http://www.tldp.org/guides.html>.
122 122
123config IPC_NS
124 bool "IPC Namespaces"
125 depends on SYSVIPC
126 default n
127 help
128 Support ipc namespaces. This allows containers, i.e. virtual
129 environments, to use ipc namespaces to provide different ipc
130 objects for different servers. If unsure, say N.
131
132config SYSVIPC_SYSCTL 123config SYSVIPC_SYSCTL
133 bool 124 bool
134 depends on SYSVIPC 125 depends on SYSVIPC
@@ -218,14 +209,6 @@ config TASK_IO_ACCOUNTING
218 209
219 Say N if unsure. 210 Say N if unsure.
220 211
221config UTS_NS
222 bool "UTS Namespaces"
223 default n
224 help
225 Support uts namespaces. This allows containers, i.e.
226 vservers, to use uts namespaces to provide different
227 uts info for different servers. If unsure, say N.
228
229config AUDIT 212config AUDIT
230 bool "Auditing support" 213 bool "Auditing support"
231 depends on NET 214 depends on NET
diff --git a/ipc/msg.c b/ipc/msg.c
index a388824740e7..cbd27e519943 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -87,7 +87,7 @@ static int newque (struct ipc_namespace *ns, key_t key, int msgflg);
87static int sysvipc_msg_proc_show(struct seq_file *s, void *it); 87static int sysvipc_msg_proc_show(struct seq_file *s, void *it);
88#endif 88#endif
89 89
90static void __ipc_init __msg_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids) 90static void __msg_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
91{ 91{
92 ns->ids[IPC_MSG_IDS] = ids; 92 ns->ids[IPC_MSG_IDS] = ids;
93 ns->msg_ctlmax = MSGMAX; 93 ns->msg_ctlmax = MSGMAX;
@@ -96,7 +96,6 @@ static void __ipc_init __msg_init_ns(struct ipc_namespace *ns, struct ipc_ids *i
96 ipc_init_ids(ids, ns->msg_ctlmni); 96 ipc_init_ids(ids, ns->msg_ctlmni);
97} 97}
98 98
99#ifdef CONFIG_IPC_NS
100int msg_init_ns(struct ipc_namespace *ns) 99int msg_init_ns(struct ipc_namespace *ns)
101{ 100{
102 struct ipc_ids *ids; 101 struct ipc_ids *ids;
@@ -128,7 +127,6 @@ void msg_exit_ns(struct ipc_namespace *ns)
128 kfree(ns->ids[IPC_MSG_IDS]); 127 kfree(ns->ids[IPC_MSG_IDS]);
129 ns->ids[IPC_MSG_IDS] = NULL; 128 ns->ids[IPC_MSG_IDS] = NULL;
130} 129}
131#endif
132 130
133void __init msg_init(void) 131void __init msg_init(void)
134{ 132{
diff --git a/ipc/sem.c b/ipc/sem.c
index 9964b2224c70..89bfdffb38d8 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -121,7 +121,7 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it);
121#define sc_semopm sem_ctls[2] 121#define sc_semopm sem_ctls[2]
122#define sc_semmni sem_ctls[3] 122#define sc_semmni sem_ctls[3]
123 123
124static void __ipc_init __sem_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids) 124static void __sem_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
125{ 125{
126 ns->ids[IPC_SEM_IDS] = ids; 126 ns->ids[IPC_SEM_IDS] = ids;
127 ns->sc_semmsl = SEMMSL; 127 ns->sc_semmsl = SEMMSL;
@@ -132,7 +132,6 @@ static void __ipc_init __sem_init_ns(struct ipc_namespace *ns, struct ipc_ids *i
132 ipc_init_ids(ids, ns->sc_semmni); 132 ipc_init_ids(ids, ns->sc_semmni);
133} 133}
134 134
135#ifdef CONFIG_IPC_NS
136int sem_init_ns(struct ipc_namespace *ns) 135int sem_init_ns(struct ipc_namespace *ns)
137{ 136{
138 struct ipc_ids *ids; 137 struct ipc_ids *ids;
@@ -164,7 +163,6 @@ void sem_exit_ns(struct ipc_namespace *ns)
164 kfree(ns->ids[IPC_SEM_IDS]); 163 kfree(ns->ids[IPC_SEM_IDS]);
165 ns->ids[IPC_SEM_IDS] = NULL; 164 ns->ids[IPC_SEM_IDS] = NULL;
166} 165}
167#endif
168 166
169void __init sem_init (void) 167void __init sem_init (void)
170{ 168{
diff --git a/ipc/shm.c b/ipc/shm.c
index 0852f206d895..242c3f66493a 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -77,7 +77,7 @@ static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp);
77static int sysvipc_shm_proc_show(struct seq_file *s, void *it); 77static int sysvipc_shm_proc_show(struct seq_file *s, void *it);
78#endif 78#endif
79 79
80static void __ipc_init __shm_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids) 80static void __shm_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
81{ 81{
82 ns->ids[IPC_SHM_IDS] = ids; 82 ns->ids[IPC_SHM_IDS] = ids;
83 ns->shm_ctlmax = SHMMAX; 83 ns->shm_ctlmax = SHMMAX;
@@ -98,7 +98,6 @@ static void do_shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *shp)
98 shm_destroy(ns, shp); 98 shm_destroy(ns, shp);
99} 99}
100 100
101#ifdef CONFIG_IPC_NS
102int shm_init_ns(struct ipc_namespace *ns) 101int shm_init_ns(struct ipc_namespace *ns)
103{ 102{
104 struct ipc_ids *ids; 103 struct ipc_ids *ids;
@@ -130,7 +129,6 @@ void shm_exit_ns(struct ipc_namespace *ns)
130 kfree(ns->ids[IPC_SHM_IDS]); 129 kfree(ns->ids[IPC_SHM_IDS]);
131 ns->ids[IPC_SHM_IDS] = NULL; 130 ns->ids[IPC_SHM_IDS] = NULL;
132} 131}
133#endif
134 132
135void __init shm_init (void) 133void __init shm_init (void)
136{ 134{
diff --git a/ipc/util.c b/ipc/util.c
index 7536a7292d48..44e5135aee47 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -50,7 +50,6 @@ struct ipc_namespace init_ipc_ns = {
50 }, 50 },
51}; 51};
52 52
53#ifdef CONFIG_IPC_NS
54static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns) 53static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns)
55{ 54{
56 int err; 55 int err;
@@ -110,14 +109,6 @@ void free_ipc_ns(struct kref *kref)
110 shm_exit_ns(ns); 109 shm_exit_ns(ns);
111 kfree(ns); 110 kfree(ns);
112} 111}
113#else
114struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
115{
116 if (flags & CLONE_NEWIPC)
117 return ERR_PTR(-EINVAL);
118 return ns;
119}
120#endif
121 112
122/** 113/**
123 * ipc_init - initialise IPC subsystem 114 * ipc_init - initialise IPC subsystem
@@ -145,7 +136,7 @@ __initcall(ipc_init);
145 * array itself. 136 * array itself.
146 */ 137 */
147 138
148void __ipc_init ipc_init_ids(struct ipc_ids* ids, int size) 139void ipc_init_ids(struct ipc_ids* ids, int size)
149{ 140{
150 int i; 141 int i;
151 142
diff --git a/ipc/util.h b/ipc/util.h
index e3aa2c5c97dc..333e891bcaca 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -41,12 +41,8 @@ struct ipc_ids {
41}; 41};
42 42
43struct seq_file; 43struct seq_file;
44#ifdef CONFIG_IPC_NS 44
45#define __ipc_init 45void ipc_init_ids(struct ipc_ids *ids, int size);
46#else
47#define __ipc_init __init
48#endif
49void __ipc_init ipc_init_ids(struct ipc_ids *ids, int size);
50#ifdef CONFIG_PROC_FS 46#ifdef CONFIG_PROC_FS
51void __init ipc_init_proc_interface(const char *path, const char *header, 47void __init ipc_init_proc_interface(const char *path, const char *header,
52 int ids, int (*show)(struct seq_file *, void *)); 48 int ids, int (*show)(struct seq_file *, void *));
diff --git a/kernel/Makefile b/kernel/Makefile
index 642d4277c2ea..fa8efd437afb 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -8,7 +8,8 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
8 signal.o sys.o kmod.o workqueue.o pid.o \ 8 signal.o sys.o kmod.o workqueue.o pid.o \
9 rcupdate.o extable.o params.o posix-timers.o \ 9 rcupdate.o extable.o params.o posix-timers.o \
10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o \
12 utsname.o
12 13
13obj-$(CONFIG_STACKTRACE) += stacktrace.o 14obj-$(CONFIG_STACKTRACE) += stacktrace.o
14obj-y += time/ 15obj-y += time/
@@ -48,7 +49,6 @@ obj-$(CONFIG_SECCOMP) += seccomp.o
48obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o 49obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
49obj-$(CONFIG_RELAY) += relay.o 50obj-$(CONFIG_RELAY) += relay.o
50obj-$(CONFIG_SYSCTL) += utsname_sysctl.o 51obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
51obj-$(CONFIG_UTS_NS) += utsname.o
52obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o 52obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
53obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o 53obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
54 54
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 9e83b589f754..e38bed75367d 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -155,16 +155,6 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
155 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC))) 155 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC)))
156 return 0; 156 return 0;
157 157
158#ifndef CONFIG_IPC_NS
159 if (unshare_flags & CLONE_NEWIPC)
160 return -EINVAL;
161#endif
162
163#ifndef CONFIG_UTS_NS
164 if (unshare_flags & CLONE_NEWUTS)
165 return -EINVAL;
166#endif
167
168 if (!capable(CAP_SYS_ADMIN)) 158 if (!capable(CAP_SYS_ADMIN))
169 return -EPERM; 159 return -EPERM;
170 160
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index f22b9dbd2a9c..c76c06466bfd 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -18,10 +18,7 @@
18static void *get_uts(ctl_table *table, int write) 18static void *get_uts(ctl_table *table, int write)
19{ 19{
20 char *which = table->data; 20 char *which = table->data;
21#ifdef CONFIG_UTS_NS 21
22 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
23 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
24#endif
25 if (!write) 22 if (!write)
26 down_read(&uts_sem); 23 down_read(&uts_sem);
27 else 24 else