From: Marian Marinov <mm@1h.com>
To: akpm@linux-foundation.org, davidlohr@hp.com,
n-horiguchi@ah.jp.nec.com, Greg KH <gregkh@linuxfoundation.org>,
manfred@colorfullife.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux Containers <containers@lists.linux-foundation.org>
Subject: [PATCH] IPC initialize shmmax and shmall from the current value not the default
Date: Sun, 04 May 2014 01:48:29 +0300 [thread overview]
Message-ID: <5365723D.7030303@1h.com> (raw)
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@jabber.org
ICQ: 7556201
Mobile: +359 886 660 270
next reply other threads:[~2014-05-03 22:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 22:48 Marian Marinov [this message]
2014-05-03 23:53 ` [PATCH] IPC initialize shmmax and shmall from the current value not the default Davidlohr Bueso
2014-05-04 0:28 ` Marian Marinov
2014-05-04 1:20 ` Davidlohr Bueso
2014-05-04 9:29 ` Marian Marinov
2014-05-04 11:17 ` Manfred Spraul
2014-05-04 17:19 ` Davidlohr Bueso
2014-05-05 19:59 ` Marian Marinov
2014-05-22 13:01 ` Marian Marinov
2014-05-25 20:01 ` Manfred Spraul
2014-05-26 0:07 ` Marian Marinov
2014-05-27 14:41 ` Serge Hallyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5365723D.7030303@1h.com \
--to=mm@1h.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=davidlohr@hp.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=n-horiguchi@ah.jp.nec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).