Bug 97399 - pppd leaks descriptor
Summary: pppd leaks descriptor
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ppp
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-14 13:36 UTC by Steve Grubb
Modified: 2015-01-08 00:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-17 09:41:49 UTC
Embargoed:


Attachments (Terms of Use)

Description Steve Grubb 2003-06-14 13:36:09 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
The pppd daemon is leaking a file descriptor to /var/run/pppd.tdb to all of its
child programs.

Version-Release number of selected component (if applicable):
ppp-2.4.1-10

How reproducible:
Always

Steps to Reproduce:
The env_audit program has instructions as to how to reproduce this. It boils
down to doing this:

pppd /dev/modem init full_path/env_audit


Actual Results:  Open file descriptor: 7
User ID of File Owner: root
Group ID of File Owner: root
WARNING - Descriptor is leaked from parent.
File type: regular file, inode - 51654, device - 776
The descriptor is: /var/run/pppd.tdb
File's actual permissions: 644
File descriptor mode is: read and write

Expected Results:  No leaks

Additional info:

retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ppp/pppd/tdb.c	2002/06/24 12:42:24	1.2
+++ ppp/pppd/tdb.c	2003/02/24 10:28:00	1.3
@@ -1134,6 +1134,7 @@
             if (tdb.fd == -1) {
 		goto fail;
             }
+	    (void) fcntl(tdb.fd, F_SETFD, FD_CLOEXEC);
         }
 
 	/* ensure there is only one process initialising at once */

Comment 1 Steve Grubb 2003-06-14 14:20:49 UTC
I found more leaks. The following patch fixes it.


--- ppp-2.4.1/pppd/sys-linux.c  2001-03-13 00:54:41.000000000 -0500
+++ ppp-2.4.1.new/pppd/sys-linux.c      2003-06-14 10:14:10.000000000 -0400
@@ -272,6 +272,7 @@
        if (flags == -1
            || fcntl(ppp_dev_fd, F_SETFL, flags | O_NONBLOCK) == -1)
            warn("Couldn't set /dev/ppp to nonblock: %m");
+       (void) fcntl(ppp_dev_fd, F_SETFD, FD_CLOEXEC);
     }
                                                                                
     /* Get an internet socket for doing socket ioctls. */
@@ -406,6 +407,7 @@
            error("Couldn't reopen /dev/ppp: %m");
            goto err;
        }
+       (void) fcntl(fd, F_SETFD, FD_CLOEXEC);
        if (ioctl(fd, PPPIOCATTCHAN, &chindex) < 0) {
            error("Couldn't attach to channel %d: %m", chindex);
            goto err_close;


Comment 2 Thomas Woerner 2004-08-17 09:41:49 UTC
Fixed in FC2 in rpm ppp-2.4.2-1 or newer.


Note You need to log in before you can comment on or make changes to this bug.