This is the mail archive of the
mailing list for the glibc project.
[PATCH] dl-load.h: Remove MAP_DENYWRITE from MAP_COPY definition
- From: Dmitrii Shcherbakov <fw dot dmitrii at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: Dmitrii Shcherbakov <fw dot dmitrii at gmail dot com>
- Date: Sat, 3 Sep 2016 21:11:18 +0300
- Subject: [PATCH] dl-load.h: Remove MAP_DENYWRITE from MAP_COPY definition
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
The Linux kernel no longer uses this flag in mmap
other than for compatibility purposes. In fact,
its support was removed many years ago according to
the mmap man page.
Let's remove it to avoid confusing output in strace
and fix a comment about this flag doing what it does
Signed-off-by: Dmitrii Shcherbakov <fw.dmitrii at gmail.com>
* elf/dl-load.h: Remove MAP_DENYWRITE from MAP_COPY d
elf/dl-load.h | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/elf/dl-load.h b/elf/dl-load.h
index 9fe7118..622c0bc 100644
@@ -37,14 +37,13 @@
from the new version after starting with pages from the old version.
To make up for the lack and avoid the overwriting problem,
- what Linux does have is MAP_DENYWRITE. This prevents anyone
- from modifying the file while we have it mapped. */
+ what Linux used to have was MAP_DENYWRITE.
+ This prevented anyone from modifying the file while it was mapped,
+ creating a denial-of-service attack possibility by using mmap given
+ read permissions to a file.
-# ifdef MAP_DENYWRITE
-# define MAP_COPY (MAP_PRIVATE | MAP_DENYWRITE)
-# define MAP_COPY MAP_PRIVATE
+# define MAP_COPY MAP_PRIVATE
/* Some systems link their relocatable objects for another base address