All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IPC initialize shmmax and shmall from the current value not the default
@ 2014-05-03 22:48 ` Marian Marinov
  0 siblings, 0 replies; 23+ messages in thread
From: Marian Marinov @ 2014-05-03 22:48 UTC (permalink / raw)
  To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, davidlohr-VXdhtT5mjnY,
	n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ, Greg KH,
	manfred-nhLOkwUX5cPe2c5cEj3t2g,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linux Containers

When we are creating new IPC namespace that should be cloned from the current namespace it is a good idea to copy the 
values of the current shmmax and shmall to the new namespace.

Copying the values of the init_ipc_ns would allow us to create new ipc namespaces with different values without granting 
them privileges to change those values.

Here is the proposed patch:

---
  ipc/shm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index 7a51443..b7a4728 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -74,8 +74,13 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it);

  void shm_init_ns(struct ipc_namespace *ns)
  {
-       ns->shm_ctlmax = SHMMAX;
-       ns->shm_ctlall = SHMALL;
+       if (ns == &init_ipc_ns) {
+               ns->shm_ctlmax = SHMMAX;
+               ns->shm_ctlall = SHMALL;
+       } else {
+               ns->shm_ctlmax = init_ipc_ns.shm_ctlmax;
+               ns->shm_ctlall = init_ipc_ns.shm_ctlall;
+       }
         ns->shm_ctlmni = SHMMNI;
         ns->shm_rmid_forced = 0;
         ns->shm_tot = 0;
-- 
1.8.4

-- 
Marian Marinov
Founder & CEO of 1H Ltd.
Jabber/GTalk: hackman-/eSpBmjxGS4dnm+yROfE0A@public.gmane.org
ICQ: 7556201
Mobile: +359 886 660 270

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-05-27 14:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-03 22:48 [PATCH] IPC initialize shmmax and shmall from the current value not the default Marian Marinov
2014-05-03 22:48 ` Marian Marinov
     [not found] ` <5365723D.7030303-108MBtLGafw@public.gmane.org>
2014-05-03 23:53   ` Davidlohr Bueso
2014-05-03 23:53     ` Davidlohr Bueso
     [not found]     ` <1399161216.2573.9.camel-5JQ4ckphU/8SZAcGdq5asR6epYMZPwEe5NbjCUgZEJk@public.gmane.org>
2014-05-04  0:28       ` Marian Marinov
2014-05-04  0:28         ` Marian Marinov
     [not found]         ` <536589B5.8060900-108MBtLGafw@public.gmane.org>
2014-05-04  1:20           ` Davidlohr Bueso
2014-05-04  1:20             ` Davidlohr Bueso
     [not found]             ` <1399166450.2573.15.camel-5JQ4ckphU/8SZAcGdq5asR6epYMZPwEe5NbjCUgZEJk@public.gmane.org>
2014-05-04  9:29               ` Marian Marinov
2014-05-04  9:29                 ` Marian Marinov
2014-05-04 11:17       ` Manfred Spraul
2014-05-04 11:17         ` Manfred Spraul
     [not found]         ` <536621D4.60002-nhLOkwUX5cPe2c5cEj3t2g@public.gmane.org>
2014-05-04 17:19           ` Davidlohr Bueso
2014-05-04 17:19             ` Davidlohr Bueso
2014-05-05 19:59         ` Marian Marinov
2014-05-22 13:01           ` Marian Marinov
     [not found]             ` <537DF520.2050904-108MBtLGafw@public.gmane.org>
2014-05-25 20:01               ` Manfred Spraul
2014-05-25 20:01                 ` Manfred Spraul
     [not found]                 ` <53824C0D.1070204-nhLOkwUX5cPe2c5cEj3t2g@public.gmane.org>
2014-05-26  0:07                   ` Marian Marinov
2014-05-26  0:07                     ` Marian Marinov
2014-05-27 14:41                   ` Serge Hallyn
2014-05-27 14:41                     ` Serge Hallyn
     [not found]           ` <5367EDB6.3010408-108MBtLGafw@public.gmane.org>
2014-05-22 13:01             ` Marian Marinov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.