mmap.2: Fix EINVAL conditions

Since introduction of MAP_SHARED_VALIDATE, in case flags contain
both MAP_PRIVATE and MAP_SHARED, mmap() doesn't fail with EINVAL,
it succeeds.

The reason for that is that MAP_SHARED_VALIDATE is in fact equal
to MAP_PRIVATE | MAP_SHARED.

This is intended behavior, see:
https://lwn.net/Articles/758594/
https://lwn.net/Articles/758598/

Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Nikola Forró 2019-06-24 13:20:55 +02:00 committed by Michael Kerrisk
parent 8952468409
commit c4f0c33fb6
1 changed files with 4 additions and 4 deletions

View File

@ -565,11 +565,11 @@ was 0.
.TP
.B EINVAL
.I flags
contained neither
.B MAP_PRIVATE
contained none of
.BR MAP_PRIVATE ,
.B MAP_SHARED
or
.BR MAP_SHARED ,
or contained both of these values.
.BR MAP_SHARED_VALIDATE .
.TP
.B ENFILE
.\" This is for shared anonymous segments