about summary refs log tree commit diff
path: root/src/ldso
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-11-15 21:28:41 -0500
committerRich Felker <dalias@aerifal.cx>2015-11-15 21:28:41 -0500
commit5fe38516f7ba0318ab792127bb16621920df3319 (patch)
tree6f73ce8baeb2cfaf79e420a2bd6e03c7aa64e441 /src/ldso
parent9e0a317d8c699278c9c8e2a829744ea098548416 (diff)
downloadmusl-5fe38516f7ba0318ab792127bb16621920df3319.tar.gz
musl-5fe38516f7ba0318ab792127bb16621920df3319.tar.xz
musl-5fe38516f7ba0318ab792127bb16621920df3319.zip
use private maps even for read-only segments of FDPIC libraries
the nommu kernel shares memory when it can anyway for private
read-only maps, but semantically the map should be private. this can
make a difference when debugging breakpoints are to be used, in which
case the kernel may need to ensure that the mapping is not shared.

the new behavior matches how the kernel FDPIC loader maps the main
program and/or program interpreter (dynamic linker) binary.
Diffstat (limited to 'src/ldso')
-rw-r--r--src/ldso/dynlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 2d24c78d..6495aeea 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -602,7 +602,7 @@ static void *map_library(int fd, struct dso *dso)
 				((ph->p_flags&PF_W) ? PROT_WRITE: 0) |
 				((ph->p_flags&PF_X) ? PROT_EXEC : 0));
 			map = mmap(0, ph->p_memsz + (ph->p_vaddr & PAGE_SIZE-1),
-				prot, (prot&PROT_WRITE) ? MAP_PRIVATE : MAP_SHARED,
+				prot, MAP_PRIVATE,
 				fd, ph->p_offset & -PAGE_SIZE);
 			if (map == MAP_FAILED) {
 				unmap_library(dso);