summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavidlohr Bueso <davidlohr@hp.com>2014-06-06 14:37:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 16:08:14 -0700
commitf57a19a7bcd9d1b4b539daad5acd12ba663812b5 (patch)
tree9ed3dabf8af83cb0e207e9acc177a6aa662091f3
parent060028bac94bf60a65415d1d55a359c3a17d5c31 (diff)
downloadlinux-f57a19a7bcd9d1b4b539daad5acd12ba663812b5.tar.bz2
ipc,shm: document new limits in the uapi header
This is useful in the future and allows users to better understand the reasoning behind the changes. Also use UL as we're dealing with it anyways. Signed-off-by: Davidlohr Bueso <davidlohr@hp.com> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/uapi/linux/shm.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h
index 74e786de6f4e..1fbf24ea37fd 100644
--- a/include/uapi/linux/shm.h
+++ b/include/uapi/linux/shm.h
@@ -8,17 +8,20 @@
#endif
/*
- * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
- * be modified by sysctl.
+ * SHMMNI, SHMMAX and SHMALL are default upper limits which can be
+ * modified by sysctl. The SHMMAX and SHMALL values have been chosen to
+ * be as large possible without facilitating scenarios where userspace
+ * causes overflows when adjusting the limits via operations of the form
+ * "retrieve current limit; add X; update limit". It is therefore not
+ * advised to make SHMMAX and SHMALL any larger. These limits are
+ * suitable for both 32 and 64-bit systems.
*/
-
#define SHMMIN 1 /* min shared seg size (bytes) */
#define SHMMNI 4096 /* max num of segs system wide */
-#define SHMMAX (ULONG_MAX - (1L<<24)) /* max shared seg size (bytes) */
-#define SHMALL (ULONG_MAX - (1L<<24)) /* max shm system wide (pages) */
+#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */
+#define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */
#define SHMSEG SHMMNI /* max shared segs per process */
-
/* Obsolete, used only for backwards compatibility and libc5 compiles */
struct shmid_ds {
struct ipc_perm shm_perm; /* operation perms */