mmap.2: Further wording tweaks to the discussion of MAP_FIXED hazards

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-04-13 09:04:35 +02:00
parent 2256fc0887
commit 71c2db6a65
1 changed files with 9 additions and 4 deletions

View File

@ -256,11 +256,16 @@ 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
The
The only safe use for
.BR MAP_FIXED
flag should be used only when the specified memory region has
already been reserved using another mapping; otherwise, its use is
hazardous because it forcibly removes preexisting mappings,
is where the address range specified by
.IR addr
and
.I length
was previously reserved using another mapping;
otherwise, the use of
.BR MAP_FIXED
is hazardous because it forcibly removes preexisting mappings,
making it easy for a multithreaded process to corrupt its own address space.
.IP
For example, suppose that thread A looks through