https://bugs.kde.org/show_bug.cgi?id=360752

--- Comment #4 from Ivo Raisr <iv...@ivosh.net> ---
I am glad you found the list useful.

However /proc/pid/{cmdline,auxv,psinfo} are *not* fd leaks. 
See this comment from m_main.c:
   //--------------------------------------------------------------
   // create fake /proc/<pid>/cmdline and /proc/<pid>/auxv files
   // and then unlink them, but hold onto the fds, so we can hand
   // them out to the client when it tries to open
   // /proc/<pid>/cmdline or /proc/<pid>/auxv for itself.

and the following one for example from syswrap-linux.c:
   /* Handle the case where the open is of /proc/self/cmdline or
      /proc/<pid>/cmdline, and just give it a copy of the fd for the
      fake file we cooked up at startup (in m_main).  Also, seek the
      cloned fd back to the start. */

While it is true that the information never changes for cmdline and auxv, it is
changed
for psinfo (see syswrap-solaris.c). Every {cmdline,auxv,psinfo} open syscall
also needs
to get its own file descriptor. Because kernel associates file position with
the fd (imagine
multiple threads opening the same file).
We do not want to keep cooked files stored on the disk because it would be hard
to clean
them up under various Valgrind exit/abort/... scenarios. Therefore the files
are created, cooked and immediately unlinked. The only reference to them are
VG_(cl_*_fd) fds.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to