This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] dl-load.h: Remove MAP_DENYWRITE from MAP_COPY definition

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
not anymore.

Signed-off-by: Dmitrii Shcherbakov <fw.dmitrii at>


	* 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
--- a/elf/dl-load.h
+++ b/elf/dl-load.h
@@ -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.
+   */
 #ifndef MAP_COPY
-# else
-#  define MAP_COPY      MAP_PRIVATE
-# endif
+# define MAP_COPY      MAP_PRIVATE
 /* Some systems link their relocatable objects for another base address

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]