2005-04-25 Roland McGrath <roland@redhat.com>
authorroland <roland>
Tue, 26 Apr 2005 04:25:58 +0000 (04:25 +0000)
committerroland <roland>
Tue, 26 Apr 2005 04:25:58 +0000 (04:25 +0000)
* elf/dl-load.c: Revert last change.

elf/dl-load.c

index 0d3fbb4..d8b3a56 100644 (file)
 # define MAP_COPY      MAP_PRIVATE
 #endif
 
+/* We want to prevent people from modifying DSOs which are currently in
+   use.  This is what MAP_DENYWRITE is for.  */
+#ifndef MAP_DENYWRITE
+# define MAP_DENYWRITE 0
+#endif
+
 /* Some systems link their relocatable objects for another base address
    than 0.  We want to know the base address for these such that we can
    subtract this address from the segment addresses during mapping.
@@ -1175,7 +1181,7 @@ cannot allocate TLS data structures for initial thread");
        /* Remember which part of the address space this object uses.  */
        l->l_map_start = (ElfW(Addr)) __mmap ((void *) mappref, maplength,
                                              c->prot,
-                                             MAP_COPY | MAP_FILE,
+                                             MAP_COPY|MAP_FILE|MAP_DENYWRITE,
                                              fd, c->mapoff);
        if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
          {