mirror of https://github.com/mkerrisk/man-pages
mmap.2: Minor rewording of MAP_FIXED text
The paragraph break-up of the existing text was somewhat unnatural. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
73cb50e21b
commit
0113b28739
12
man2/mmap.2
12
man2/mmap.2
|
@ -225,16 +225,16 @@ part of the existing mapping(s) will be discarded.
|
|||
If the specified address cannot be used,
|
||||
.BR mmap ()
|
||||
will fail.
|
||||
.IP
|
||||
Software that aspires to be portable should use this option with care,
|
||||
keeping in mind that the exact layout of a process's memory mappings
|
||||
is allowed to change significantly between kernel versions,
|
||||
C library versions, and operating system releases.
|
||||
.IP
|
||||
Furthermore, this option is extremely hazardous (when used on its own),
|
||||
because it forcibly removes preexisting mappings,
|
||||
making it easy for a multithreaded process to corrupt its own address space.
|
||||
.IP
|
||||
For example, thread A looks through
|
||||
For example, suppose that thread A looks through
|
||||
.I /proc/<pid>/maps
|
||||
and locates an available address range,
|
||||
while thread B simultaneously acquires part or all of that same
|
||||
|
@ -242,12 +242,11 @@ address range.
|
|||
Thread A then calls
|
||||
.BR mmap(MAP_FIXED) ,
|
||||
effectively overwriting the mapping that thread B created.
|
||||
.IP
|
||||
Thread B need not create a mapping directly; simply making a library call
|
||||
In this scenario,
|
||||
thread B need not create a mapping directly; simply making a library call
|
||||
that, internally, uses
|
||||
.BR dlopen (3)
|
||||
to load some other shared library, will
|
||||
suffice.
|
||||
to load some other shared library, will suffice.
|
||||
The
|
||||
.BR dlopen (3)
|
||||
call will map the library into the process's address space.
|
||||
|
@ -261,6 +260,7 @@ Examples include
|
|||
and the PAM libraries
|
||||
.UR http://www.linux-pam.org
|
||||
.UE .
|
||||
.IP
|
||||
Newer kernels
|
||||
(Linux 4.17 and later) have a
|
||||
.B MAP_FIXED_NOREPLACE
|
||||
|
|
Loading…
Reference in New Issue