I try to figure out the range of the shared memory segment i.e. the memory mapping segment in the memory layout of a process, from two sources below.
From https://manybutfinite.com/post/anatomy-of-a-program-in-memory/, I found a diagram of memory layout of a process
Do memory mapping segment and heap grow until they meet each other?
Or is there a limit for each of the two segments to grow up to, similar to RLIMIT_STACK for the stack segement?
From The Linux Programming Interface
To allow space for heap and stack growth, shared memory segments are attached starting at the virtual address 0x40000000 . Mapped mappings (Chapter 49) and shared libraries (Chapters 41 and 42) are also placed in this area. (There is some variation in the default location at which shared memory mappings and memory segments are placed, depending on the kernel versions and the setting of the process’s RLIMIT_STACK resource limit.) The address 0x40000000 is defined as the kernel constant TASK_UNMAPPED_BASE.
Does the shared memory segment start at TASK_UNMAPPED_BASE and grow upward?
Note that the previous diagram shows the shared memory segment grow downward, so does it grow upward or downward?