Bug 60807 - daemon function in /etc/rc.d/init.d/functions could close file descriptors
Summary: daemon function in /etc/rc.d/init.d/functions could close file descriptors
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 7.0
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-07 05:09 UTC by Patrick Baltz
Modified: 2014-03-17 02:25 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-02-22 20:43:17 UTC
Embargoed:


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

Description Patrick Baltz 2002-03-07 05:09:54 UTC
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:
Always

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
descriptors
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:
apache-1.3.20
php-4.0.6
netkit-base-0.17

Comment 1 Patrick Baltz 2002-03-07 05:17:58 UTC
Created attachment 47700 [details]
possible fix for this bug

Comment 2 Bill Nottingham 2005-02-22 20:43:17 UTC
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.