diff options
author | kib <kib@FreeBSD.org> | 2011-09-20 21:49:54 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-09-20 21:49:54 +0000 |
commit | 11cece0abe4194bf4ad441d27876dbd03feba22d (patch) | |
tree | 0c30dfc63297c4a18d6536a1de310016ffc96fad | |
parent | e3079e135045be785504016388812896091a9cb5 (diff) | |
download | FreeBSD-src-11cece0abe4194bf4ad441d27876dbd03feba22d.zip FreeBSD-src-11cece0abe4194bf4ad441d27876dbd03feba22d.tar.gz |
Restore the writing of the .bss sections of the dsos (not the main
executable) after r190885. The whole region for the dso is mmaped with
MAP_NOCORE flag, doing only mprotect(2) over .bss prevented it from
writing .bss to core files.
Revert the optimization of using mprotect(2) to establish .bss, overlap
the section with mmap(2).
Reported by: attilio
Reviewed by: attilio, emaste
Approved by: re (bz)
MFC after: 2 weeks
-rw-r--r-- | libexec/rtld-elf/map_object.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 2b33862..aca1b2d 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -215,8 +215,9 @@ map_object(int fd, const char *path, const struct stat *sb) bss_vlimit = round_page(segs[i]->p_vaddr + segs[i]->p_memsz); bss_addr = mapbase + (bss_vaddr - base_vaddr); if (bss_vlimit > bss_vaddr) { /* There is something to do */ - if (mprotect(bss_addr, bss_vlimit - bss_vaddr, data_prot) == -1) { - _rtld_error("%s: mprotect of bss failed: %s", path, + if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, + data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { + _rtld_error("%s: mmap of bss failed: %s", path, strerror(errno)); return NULL; } |