Bug 97399 - pppd leaks descriptor
pppd leaks descriptor
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: ppp (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Woerner
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-06-14 09:36 EDT by Steve Grubb
Modified: 2015-01-07 19:05 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-17 05:41:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steve Grubb 2003-06-14 09:36:09 EDT
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 10:20:49 EDT
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 05:41:49 EDT
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.