Skip to content

Commit 9220066

Browse files
legionusakpm00
authored andcommitted
docs: add information about ipc sysctls limitations
After 25b21cb ("[PATCH] IPC namespace core") and 4e98231 ("[PATCH] IPC namespace - shm") the shared memory page count stopped being global and started counting per ipc namespace. The documentation and shmget(2) still says that shmall is a global option. shmget(2): SHMALL System-wide limit on the total amount of shared memory, measured in units of the system page size. On Linux, this limit can be read and modified via /proc/sys/kernel/shmall. I think the changes made in 2006 should be documented. Link: https://lkml.kernel.org/r/09e99911071766958af488beb4e8a728a4f12135.1705333426.git.legion@kernel.org Signed-off-by: Alexey Gladkov <legion@kernel.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Link: https://lkml.kernel.org/r/ede20ddf7be48b93e8084c3be2e920841ee1a641.1663756794.git.legion@kernel.org Cc: Christian Brauner <brauner@kernel.org> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Joel Granados <joel.granados@gmail.com> Cc: Kees Cook <keescook@chromium.org> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 50ec499 commit 9220066

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Documentation/admin-guide/sysctl/kernel.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ default (``MSGMNB``).
594594
``msgmni`` is the maximum number of IPC queues. 32000 by default
595595
(``MSGMNI``).
596596

597+
All of these parameters are set per ipc namespace. The maximum number of bytes
598+
in POSIX message queues is limited by ``RLIMIT_MSGQUEUE``. This limit is
599+
respected hierarchically in the each user namespace.
597600

598601
msg_next_id, sem_next_id, and shm_next_id (System V IPC)
599602
========================================================
@@ -1274,15 +1277,20 @@ are doing anyway :)
12741277
shmall
12751278
======
12761279

1277-
This parameter sets the total amount of shared memory pages that
1278-
can be used system wide. Hence, ``shmall`` should always be at least
1279-
``ceil(shmmax/PAGE_SIZE)``.
1280+
This parameter sets the total amount of shared memory pages that can be used
1281+
inside ipc namespace. The shared memory pages counting occurs for each ipc
1282+
namespace separately and is not inherited. Hence, ``shmall`` should always be at
1283+
least ``ceil(shmmax/PAGE_SIZE)``.
12801284

12811285
If you are not sure what the default ``PAGE_SIZE`` is on your Linux
12821286
system, you can run the following command::
12831287

12841288
# getconf PAGE_SIZE
12851289

1290+
To reduce or disable the ability to allocate shared memory, you must create a
1291+
new ipc namespace, set this parameter to the required value and prohibit the
1292+
creation of a new ipc namespace in the current user namespace or cgroups can
1293+
be used.
12861294

12871295
shmmax
12881296
======

0 commit comments

Comments
 (0)