lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1459624654-7955-4-git-send-email-kwapulinski.piotr@gmail.com>
Date:	Sat,  2 Apr 2016 21:17:34 +0200
From:	Piotr Kwapulinski <kwapulinski.piotr@...il.com>
To:	akpm@...ux-foundation.org
Cc:	mhocko@...e.com, mtk.manpages@...il.com, cmetcalf@...lanox.com,
	arnd@...db.de, viro@...iv.linux.org.uk, mszeredi@...e.cz,
	dave@...olabs.net, kirill.shutemov@...ux.intel.com, vbabka@...e.cz,
	mingo@...nel.org, dan.j.williams@...el.com,
	dave.hansen@...ux.intel.com, koct9i@...il.com, hannes@...xchg.org,
	jack@...e.cz, xiexiuqi@...wei.com, iamjoonsoo.kim@....com,
	oleg@...hat.com, gang.chen.5i5j@...il.com, aarcange@...hat.com,
	aryabinin@...tuozzo.com, rientjes@...gle.com, denc716@...il.com,
	toshi.kani@....com, ldufour@...ux.vnet.ibm.com,
	kuleshovmail@...il.com, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, linux-arch@...r.kernel.org,
	Piotr Kwapulinski <kwapulinski.piotr@...il.com>
Subject: [PATCH 3/3] man/mremap.2: don't unmap the overlapping VMA(s)

mremap.2 man page update for MREAP_DONTUNMAP flag of mremap.

Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@...il.com>
---
It should be considered to be merged only in case the patch
"[PATCH 2/3] mm/mremap.c: don't unmap the overlapping VMA(s)"
is merged.
---
 man2/mremap.2 | 50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 5 deletions(-)

diff --git a/man2/mremap.2 b/man2/mremap.2
index e4998a4..978d509 100644
--- a/man2/mremap.2
+++ b/man2/mremap.2
@@ -27,7 +27,7 @@
 .\"            Update for Linux 1.3.87 and later
 .\" 2005-10-11 mtk: Added NOTES for MREMAP_FIXED; revised EINVAL text.
 .\"
-.TH MREMAP 2 2015-12-05 "Linux" "Linux Programmer's Manual"
+.TH MREMAP 2 2016-04-02 "Linux" "Linux Programmer's Manual"
 .SH NAME
 mremap \- remap a virtual memory address
 .SH SYNOPSIS
@@ -104,7 +104,9 @@ accepts a fifth argument,
 .IR "void\ *new_address" ,
 which specifies a page-aligned address to which the mapping must
 be moved.
-Any previous mapping at the address range specified by
+If
+.B MREMAP_DONTUNMAP
+is not set then any previous mapping at the address range specified by
 .I new_address
 and
 .I new_size
@@ -114,6 +116,30 @@ If
 is specified, then
 .B MREMAP_MAYMOVE
 must also be specified.
+.TP
+.BR MREMAP_DONTUNMAP " (since Linux 4.6)"
+This flag is similar to
+.B MAP_DONTUNMAP
+flag of
+.BR mmap (2).
+If this flag and
+.B MREMAP_FIXED
+are set and the memory region specified by
+.I new_address
+and
+.I new_size
+overlaps pages of any existing mapping(s), then the
+.BR mremap ()
+will fail with
+.BR ENOMEM .
+No existing mapping(s) will be discarded. If
+.B MREMAP_DONTUNMAP
+is specified, then
+.B MREMAP_FIXED
+must also be specified.
+
+Note: currently, this flag is not implemented in the glibc wrapper.
+Use the numerical value 4, if you want to use it.
 .PP
 If the memory segment specified by
 .I old_address
@@ -156,8 +182,9 @@ page aligned; a value other than
 .B MREMAP_MAYMOVE
 or
 .B MREMAP_FIXED
-was specified in
-.IR flags ;
+or
+.B MREMAP_DONTUNMAP
+was specified in \fIflags\fP;
 .I new_size
 was zero;
 .I new_size
@@ -175,13 +202,26 @@ and
 or
 .B MREMAP_FIXED
 was specified without also specifying
-.BR MREMAP_MAYMOVE .
+.BR MREMAP_MAYMOVE ;
+or
+.B MREMAP_DONTUNMAP
+was specified without also specifying
+.BR MREMAP_FIXED .
 .TP
 .B ENOMEM
 The memory area cannot be expanded at the current virtual address, and the
 .B MREMAP_MAYMOVE
 flag is not set in \fIflags\fP.
 Or, there is not enough (virtual) memory available.
+Or, both the
+.B MREMAP_FIXED
+and
+.B MREMAP_DONTUNMAP
+flags are set and the memory region specified by
+.I new_address
+and
+.I new_size
+overlaps pages of any existing mapping(s).
 .SH CONFORMING TO
 This call is Linux-specific, and should not be used in programs
 intended to be portable.
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ