git: rtld: Sync 5/7 - Fix fd leak with parallel dlopen and fork

John Marino marino at crater.dragonflybsd.org
Thu Jun 13 04:13:17 PDT 2013


commit 042953d8e3173add9848fe8ddbedc413a77cccc4
Author: John Marino <draco at marino.st>
Date:   Thu Jun 13 01:42:14 2013 +0200

    rtld: Sync 5/7 - Fix fd leak with parallel dlopen and fork
    
    Rtld did not set FD_CLOEXEC on its internal file descriptors; therefore,
    such a file descriptor may be passed to a process created by another
    thread running in parallel to dlopen() or fdlopen().
    
    No other threads are expected to be running during parsing of the hints
    and libmap files but the file descriptors need not be passed to child
    processes so add O_CLOEXEC there as well.
    
    As the F_DUPFD_CLOEXEC support was added in the kernel today, rtld
    will temporarily fall back to separate dup/cloexec commands if
    F_DUPFD_CLOEXEC fails.  This fallback should be removed before
    3.6 branches.
    
    Taken from:
    FreeBSD SVN 242587 (04 NOV 2012)

Summary of changes:
 libexec/rtld-elf/libmap.c |  2 +-
 libexec/rtld-elf/rtld.c   | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/042953d8e3173add9848fe8ddbedc413a77cccc4


-- 
DragonFly BSD source repository



More information about the Commits mailing list