O_CLOEXEC and dynamic loading

Ross Lagerwall rosslagerwall@gmail.com
Thu Sep 8 13:02:00 GMT 2011


On Thu, 2011-09-08 at 00:02 -0400, Ulrich Drepper wrote:
> Patches must be based on the most recent sources.  I've added the missing flag.

Thanks for patching it :-)

>From what I understand, your commits have added O_CLOEXEC for
opening /etc/ld.so.cache and any *.so library file.

The other part of the test program used a dns lookup. I would assume
that it should also use the cloexec flag on all the files and sockets
that it uses otherwise a dns lookup and fork in parallel could cause an
fd to be leaked.

Attached is an *untested* patch against the latest master which adds the
cloexec flag to the places where it seems to be needed for dns lookups.
(I am not familiar with the glibc codebase so I may have missed a few)

Cheers
Ross
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cloexec.patch
Type: text/x-patch
Size: 4436 bytes
Desc: 
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110908/39a39384/attachment.bin>


More information about the Libc-alpha mailing list