Blame SOURCES/1595662-mpo-7.8.0-mmap.2.patch

196bfa
From f703950fc461d87b9833246be8721593aa5ec460 Mon Sep 17 00:00:00 2001
196bfa
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
196bfa
Date: Thu, 8 Aug 2019 16:59:54 +0200
196bfa
Subject: [PATCH 2/6] mmap.2: fix EINVAL conditions
196bfa
---
196bfa
 man-pages/man2/mmap.2 | 60 +++++++++++++++++++++++++++++++++++++------
196bfa
 1 file changed, 52 insertions(+), 8 deletions(-)
196bfa
196bfa
diff --git a/man-pages/man2/mmap.2 b/man-pages/man2/mmap.2
196bfa
index 798e0dd..6a9248c 100644
196bfa
--- a/man-pages/man2/mmap.2
196bfa
+++ b/man-pages/man2/mmap.2
196bfa
@@ -126,6 +126,23 @@ or
196bfa
 .BR munmap ()
196bfa
 is called.
196bfa
 .TP
196bfa
+.BR MAP_SHARED_VALIDATE " (since Linux 4.15)"
196bfa
+This flag provides the same behavior as
196bfa
+.B MAP_SHARED
196bfa
+except that
196bfa
+.B MAP_SHARED
196bfa
+mappings ignore unknown flags in
196bfa
+.IR flags .
196bfa
+By contrast, when creating a mapping using
196bfa
+.BR MAP_SHARED_VALIDATE ,
196bfa
+the kernel verifies all passed flags are known and fails the
196bfa
+mapping with the error
196bfa
+.BR EOPNOTSUPP
196bfa
+for unknown flags.
196bfa
+This mapping type is also required to be able to use some mapping flags
196bfa
+(e.g.,
196bfa
+.BR MAP_SYNC ).
196bfa
+.TP
196bfa
 .B MAP_PRIVATE
196bfa
 Create a private copy-on-write mapping.
196bfa
 Updates to the mapping are not visible to other processes
196bfa
@@ -135,8 +152,14 @@ It is unspecified whether changes made to the file after the
196bfa
 .BR mmap ()
196bfa
 call are visible in the mapped region.
196bfa
 .LP
196bfa
-Both of these flags are described in POSIX.1-2001.
196bfa
-
196bfa
+Both
196bfa
+.B MAP_SHARED
196bfa
+and
196bfa
+.B MAP_PRIVATE
196bfa
+are described in POSIX.1-2001 and POSIX.1-2008.
196bfa
+.B MAP_SHARED_VALIDATE
196bfa
+is a Linux extension.
196bfa
+.LP
196bfa
 In addition, zero or more of the following values can be ORed in
196bfa
 .IR flags :
196bfa
 .TP
196bfa
@@ -290,6 +313,27 @@ support can later be transparently implemented for glibc.
196bfa
 .\" "pthread_create() slow for many threads; also time to revisit 64b
196bfa
 .\"  context switch optimization?"
196bfa
 .TP
196bfa
+.BR MAP_SYNC " (since Linux 4.15)"
196bfa
+This flag is available only with the
196bfa
+.B MAP_SHARED_VALIDATE
196bfa
+mapping type;
196bfa
+mappings of type
196bfa
+.B MAP_SHARED
196bfa
+will silently ignore this flag.
196bfa
+This flag is supported only for files supporting DAX
196bfa
+(direct mapping of persistent memory).
196bfa
+For other files, creating a mapping with this flag results in an
196bfa
+.B EOPNOTSUPP
196bfa
+error.
196bfa
+.IP
196bfa
+Shared file mappings with this flag provide the guarantee that while
196bfa
+some memory is writably mapped in the address space of the process,
196bfa
+it will be visible in the same file at the same offset even after
196bfa
+the system crashes or is rebooted.
196bfa
+In conjunction with the use of appropriate CPU instructions,
196bfa
+this provides users of such mappings with a more efficient way
196bfa
+of making data modifications persistent.
196bfa
+.TP
196bfa
 .BR MAP_UNINITIALIZED " (since Linux 2.6.33)"
196bfa
 Don't clear anonymous pages.
196bfa
 This flag is intended to improve performance on embedded devices.
196bfa
@@ -302,7 +346,7 @@ that option is normally enabled only on embedded devices
196bfa
 .LP
196bfa
 Of the above flags, only
196bfa
 .B MAP_FIXED
196bfa
-is specified in POSIX.1-2001.
196bfa
+is specified in POSIX.1-2001 and POSIX.1-2008.
196bfa
 However, most systems also support
196bfa
 .B MAP_ANONYMOUS
196bfa
 (or its synonym
196bfa
@@ -436,11 +480,11 @@ was 0.
196bfa
 .TP
196bfa
 .B EINVAL
196bfa
 .I flags
196bfa
-contained neither
196bfa
-.B MAP_PRIVATE
196bfa
+contained none of
196bfa
+.BR MAP_PRIVATE ,
196bfa
+.B MAP_SHARED
196bfa
 or
196bfa
-.BR MAP_SHARED ,
196bfa
-or contained both of these values.
196bfa
+.BR MAP_SHARED_VALIDATE .
196bfa
 .TP
196bfa
 .B ENFILE
196bfa
 .\" This is for shared anonymous segments
196bfa
@@ -495,7 +539,7 @@ Attempted access to a portion of the buffer that does not correspond
196bfa
 to the file (for example, beyond the end of the file, including the
196bfa
 case where another process has truncated the file).
196bfa
 .SH CONFORMING TO
196bfa
-SVr4, 4.4BSD, POSIX.1-2001.
196bfa
+POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD.
196bfa
 .\" SVr4 documents additional error codes ENXIO and ENODEV.
196bfa
 .\" SUSv2 documents additional error codes EMFILE and EOVERFLOW.
196bfa
 .SH AVAILABILITY
196bfa
-- 
196bfa
2.21.0
196bfa