Bug 60807 - daemon function in /etc/rc.d/init.d/functions could close file descriptors
daemon function in /etc/rc.d/init.d/functions could close file descriptors
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2002-03-07 00:09 EST by Patrick Baltz
Modified: 2014-03-16 22:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-02-22 15:43:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
possible fix for this bug (339 bytes, patch)
2002-03-07 00:17 EST, Patrick Baltz
no flags Details | Diff

  None (edit)
Description Patrick Baltz 2002-03-07 00:09:54 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.8) Gecko/20020205

Description of problem:
A php script I had was exec'ing a program into the background, which eventually
called '/etc/rc.d/init.d/inet start'.  When trying to restart the web server, it
failed with an error saying it could not bind to it's port.  Examining the port
usage with 'fuser' showed that inetd was the program that was using the port. 
If I run the same program from the command line, the web server is unaffected. 
It appears that if file descriptors are not closed at some point along the way,
misbehaving daemon programs could bind to ports that they shouldn't by
inheriting file descriptors from their parent process.

Ideally this all gets fixed in the daemon itself or in the parent process that
is going to end up starting a daemon, but the daemon function in
/etc/rc.d/init.d/functions could provide some protection from this situation.

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

How reproducible:

Steps to Reproduce:
1.Exec a program from a php script that doesn't close any file descriptors
2.Start a daemon such as inetd that doesn't properly close all unnecessary file
3.Try to restart the web server that executed the php script

Actual Results:  The web server failed to restart and the error log reported
that the server was unable to bind to it's listen port.

Expected Results:  The web server restarts successfully.

Additional info:

This was with:
Comment 1 Patrick Baltz 2002-03-07 00:17:58 EST
Created attachment 47700 [details]
possible fix for this bug
Comment 2 Bill Nottingham 2005-02-22 15:43:17 EST
Closing out bugs on older, no longer supported releases. Apologies for any lack
of response. Please reopen if it persists on current releases.

Open or closed filedescriptors should not affect what port a daemon binds to.

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