git: rtld: Sync 2/7 - Remove potential map leakage

John Marino marino at
Thu Jun 13 04:13:14 PDT 2013

commit e2f980f582877c02b3e2b96ea49aa5f3cf14a640
Author: John Marino <draco at>
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
    Taken from:
    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 mailing list