[lldb-dev] [PATCH] Avoid leaking file descriptors.
tfiala at google.com
Tue Mar 25 13:43:26 PDT 2014
Looking at this now.
On Sat, Mar 22, 2014 at 8:43 AM, Piotr Rak <piotr.rak at gmail.com> wrote:
> I've noticed that we leak file descriptors, since we don't use O_CLOEXEC
> when opening files.
> I've changed lldb_utility::PseudoTerminal, debugserver version of it and
> lldb_private::File to set it while opening by default.
> This can be disabled by defining:
> LLDB_DISABLE_O_CLOEXEC and LLDB_DISABLE_DUPFD_CLOEXEC, currently not
> integrated with any filesystem.
> It also should compile if O_CLOEXEC and F_DUPFD_CLOEXEC aren't defined,
> and give compilation warning.
> Also added new File open option:
> eOpenOptionInheritOnExecPosixFD that makes it fallback to old behavior,
> however in whole code base it was not required, and could be removed...
> I went pretty carefully through fork()/exec() and posix_spawn() codepaths
> to ensure that everything is OK, and it looked it is, but might have missed
> None of them required changes, from what I have noticed, since use dup2 or
> If any of your out of tree code needs to be adjusted, PseudoTerminal::Fork
> looks like good example how to pass fd without leaking.
> I've tested linux amd64 and haven't noticed any regressions comparing to
> trunk, but some tests fail in non-deterministic way, so could mask it...
> Most notably:
> Managed to make them fail with and without the patch running in separate.
> I've possibly broke debugserver when WITH_SPRINGBOARD is defined for
> launch code path.
> I don't know SBSLaunchApplicationForDebugging semantics, and have no idea
> how to fix it, beside disabling it for PseudoTerminal if this option is
> Those changes are not strictly required for debugserver yet I have made
> them for completeness.
> Both raw diff and git patch are attached.
> Please test attached, and report back if any problems are noticed.
> @Greg, sorry that it took longer than I thought it will.
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev