git: rtld: Sync 2/7 - Remove potential map leakage
marino at crater.dragonflybsd.org
Thu Jun 13 04:13:14 PDT 2013
Author: John Marino <draco at marino.st>
Date: Wed Jun 12 13:15:29 2013 +0200
rtld: Sync 2/7 - Remove potential map leakage
Eliminate the static buffer used to read the first page of the mapped
object, and eliminate the pread(2) call as well. Mmap the first page
of the object temporarily and unmap it on error or last use. Potentially
this leaves a one page gap between succeeding dlopen(3), but there are
other mmap(2) consumers as well.
This fixes several cases where the whole mapping of the object leaked
upon error. The MAP_PREFAULT_READ code had to be skipped because the
mmap on DragonFly doesn't support this flag.
Map libraries linked with -Ttext-segment=base_addr at base_addr.
Normal libraries have a base address of zero and are unaffected by this
FreeBSD SVN 237058 (14 JUN 2012)
FreeBSD SVN 247396 (27 FEB 2013)
Summary of changes:
libexec/rtld-elf/map_object.c | 132 ++++++++++++++++++++++--------------------
1 file changed, 70 insertions(+), 62 deletions(-)
DragonFly BSD source repository
More information about the Commits