DragonFly BSD
DragonFly commits List (threaded) for 2013-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: John Marino <marino@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Jun 2013 04:13:14 -0700 (PDT)

commit e2f980f582877c02b3e2b96ea49aa5f3cf14a640
Author: John Marino <draco@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
    change.
    
    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(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e2f980f582877c02b3e2b96ea49aa5f3cf14a640


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]