summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-26 06:42:16 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-26 06:42:16 +0000
commit1773d1ba5fa4c82e3a609f11742e159039b01c24 (patch)
tree971c00b818979ef1463d669f9b724988360e8220 /elf
parentffdd5e50e18b0cb212acad135e421d932cf3d3a2 (diff)
Update.
2004-05-25 Ulrich Drepper <drepper@redhat.com> * nss/digits_dots.c (__nss_hostname_digits_dots): Remove typep and flags parameter, convert afp to simple int parameter. Adjust code. typep was never != NULL and flags therefore also unused. *afp is never modified. * nss/nsswitch.h: Adjust __nss_hostname_digits_dots prototype. * nss/getXXbyYY.c: Remove HAVE_TYPE handling. Adjust af parameter handling for __nss_hostname_digits_dots calls. * nss/getXXbyYY_r.c: Likewise. * elf/dl-load.c (_dl_map_object_from_fd): Map DSOs with MAP_DENYWRITE.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 5ff472a46b..f85ae586a1 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -53,6 +53,12 @@
# 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.
@@ -1092,7 +1098,8 @@ 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,
+ c->prot,
+ MAP_COPY|MAP_FILE|MAP_DENYWRITE,
fd, c->mapoff);
if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
{
@@ -1141,7 +1148,8 @@ cannot allocate TLS data structures for initial thread");
/* Map the segment contents from the file. */
&& (__mmap ((void *) (l->l_addr + c->mapstart),
c->mapend - c->mapstart, c->prot,
- MAP_FIXED | MAP_COPY | MAP_FILE, fd, c->mapoff)
+ MAP_FIXED|MAP_COPY|MAP_FILE|MAP_DENYWRITE,
+ fd, c->mapoff)
== MAP_FAILED))
goto map_error;