bugfindutils - Bugs: bug #27375, find leaks fds to child processes

 
 

bug #27375: find leaks fds to child processes

Submitter:  Eric Blake <ericb>
Submitted:  Wed 02 Sep 2009 09:37:26 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Eric Blake Open/Closed:  Closed
Release:  None Fixed Release:  4.5.6b
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 29 Mar 2010 11:53:49 PM UTC, comment #3: 

Fixed in 4.5.x (i.e. the "master" branch in git)

(I changed the patch a little to fix some "make dist" bugs and have the check controlled by an environment variable)

James Youngman <jay>
Group administrator
Mon 29 Mar 2010 10:30:30 AM UTC, comment #2: 

The attached patch should fix the problem and include a self-test (though it's not a regression test).


(file #20064)

James Youngman <jay>
Group administrator
Wed 02 Sep 2009 09:52:00 PM UTC, comment #1: 

This patch fixes part of the leak; the other part comes from updating gnulib to pick up my patch to plug fts.  Still needs NEWS and a testsuite addition (ls /proc/self/fd is cute, but it would be nice if there were something more portable.  Using -exec sh -c 'exec 4<&3' \; and checking for an error message from sh relating to failure to clone fd 3 from sh may be a bit better, but that is still not portable to all shells).


(file #18671)

Eric Blake <ericb>
Group administrator
Wed 02 Sep 2009 09:37:26 PM UTC, original submission:  

Find currently leaks directory fds to child processes.  This could be considered a minor security hole, since a rogue child could fchdir into a directory that would otherwise be inaccessible, or even play games such as using rewinddir(fdopendir(n)) on a leaked fd to change the state visible if the parent later calls readdir on the same underlying fd.  Also, the leak puts the child that much closer to hitting EMFILE limits.


$ find dir -exec ls -l /proc/self/fd \;
total 0
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 0 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 1 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 2 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 3 -> /home/eblake/findutils
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 4 -> /proc/8064/fd
total 0
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 0 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 1 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 2 -> /dev/tty1
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 3 -> /home/eblake/findutils
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 4 -> /proc/69896/fd
lrwxrwxrwx 1 eblake Domain Users 0 Nov 30  2006 5 -> /home/eblake/findutils/dir


Eric Blake <ericb>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #18671:  findutils.patch1 added by ericb (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by ericb (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-03-31 jay Open/ClosedOpen Closed
        Fixed ReleaseNone 4.5.6b
    2010-03-29 jay StatusConfirmed Fixed
        Assigned toericb jay
    2010-03-29 jay Attached File- Added 0001-Fix-file-descriptor-leaks.patch, #20064
    2009-09-02 ericb Attached File- Added findutils.patch1, #18671

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code