]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipc: sysv shared memory limited to 8TiB
authorRobin Holt <holt@sgi.com>
Wed, 1 May 2013 02:15:54 +0000 (19:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 02:57:27 +0000 (19:57 -0700)
commit d69f3bad4675ac519d41ca2b11e1c00ca115cecd upstream.

Trying to run an application which was trying to put data into half of
memory using shmget(), we found that having a shmall value below 8EiB-8TiB
would prevent us from using anything more than 8TiB.  By setting
kernel.shmall greater than 8EiB-8TiB would make the job work.

In the newseg() function, ns->shm_tot which, at 8TiB is INT_MAX.

ipc/shm.c:
 458 static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 459 {
...
 465         int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
...
 474         if (ns->shm_tot + numpages > ns->shm_ctlall)
 475                 return -ENOSPC;

[akpm@linux-foundation.org: make ipc/shm.c:newseg()'s numpages size_t, not int]
Signed-off-by: Robin Holt <holt@sgi.com>
Reported-by: Alex Thorlton <athorlton@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/ipc_namespace.h
ipc/shm.c

index a6d1655f9607de872a10fecaa744e38412c8edb2..f1605b554fbb3220b7c1cec94e039ba14f87d9e0 100644 (file)
@@ -42,8 +42,8 @@ struct ipc_namespace {
 
        size_t          shm_ctlmax;
        size_t          shm_ctlall;
+       unsigned long   shm_tot;
        int             shm_ctlmni;
-       int             shm_tot;
 
        struct notifier_block ipcns_nb;
 
index ab3385a21b27ac9b528ea270f2d4567522d2c966..10e17a7ccadacf1c71609dbe38c4bfb8b278f4ed 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -343,7 +343,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
        size_t size = params->u.size;
        int error;
        struct shmid_kernel *shp;
-       int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
+       size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
        struct file * file;
        char name[13];
        int id;