svn commit: r318312 - head/libexec/rtld-elf
Konstantin Belousov
kib at FreeBSD.org
Mon May 15 18:47:27 UTC 2017
Author: kib
Date: Mon May 15 18:47:25 2017
New Revision: 318312
URL: https://svnweb.freebsd.org/changeset/base/318312
Log:
Fix the AT_EXECFD functionality.
If the mapped object is linked at specific address, we must obey it.
If AT_EXECFD is not used, only in-kernel ELF image activator needed to
keep the mapping address, since only binaries are linked at the fixed
address, and binaries are mapped by kernel in this case.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D10701
Modified:
head/libexec/rtld-elf/map_object.c
Modified: head/libexec/rtld-elf/map_object.c
==============================================================================
--- head/libexec/rtld-elf/map_object.c Mon May 15 18:41:12 2017 (r318311)
+++ head/libexec/rtld-elf/map_object.c Mon May 15 18:47:25 2017 (r318312)
@@ -193,6 +193,8 @@ map_object(int fd, const char *path, con
base_flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE;
if (npagesizes > 1 && round_page(segs[0]->p_filesz) >= pagesizes[1])
base_flags |= MAP_ALIGNED_SUPER;
+ if (base_vaddr != 0)
+ base_flags |= MAP_FIXED | MAP_EXCL;
mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0);
if (mapbase == (caddr_t) -1) {
More information about the svn-src-head
mailing list