Bug 30737

Summary: sysinstall(8): sysinstall leaks file descriptors on restart
Product: Base System Reporter: alex.neyman <alex.neyman>
Component: binAssignee: freebsd-sysinstall (Nobody) <sysinstall>
Status: Closed Overcome By Events    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description alex.neyman 2001-09-22 17:10:01 UTC
In a signal handler for ^C, the user is given a possibility to restart
the installation utility. However, restart procedure does not close already
open file descriptors, thus, new sysinstall starts with fewer fds.

Fix: (the patch is untested)
How-To-Repeat: Run the installation; hit ^C, choose Restart and look at VTY2. You'll see
that the fd number for ioctl(TIOCCONS) is rising each time you hit
^C -> Restart.
Comment 1 alex.neyman 2001-09-22 18:06:51 UTC
>Number:         30737
>Category:       bin
>Synopsis:       sysinstall leaks file descriptors on restart
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 22 09:10:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alexey V. Neyman
>Release:        FreeBSD 4.4-RELEASE
>Organization:
Auriga, Inc.
>Environment:
n/a
>Description:
In a signal handler for ^C, the user is given a possibility to restart
the installation utility. However, restart procedure does not close already
open file descriptors, thus, new sysinstall starts with fewer fds.
>How-To-Repeat:
Run the installation; hit ^C, choose Restart and look at VTY2. You'll see
that the fd number for ioctl(TIOCCONS) is rising each time you hit
^C -> Restart.
>Fix:
(the patch is untested)
--- system.c.orig	Sat Sep 22 19:49:49 2001
+++ system.c	Sat Sep 22 19:52:33 2001
@@ -56,6 +56,11 @@
 static int
 intr_restart(dialogMenuItem *self)
 {
+	int fd, fdmax;
+
+	fdmax = getdtablesize();
+	for (fd = 3; fd < fdmax; fd++)
+		close(fd);
 	execl(StartName, StartName, (char *)NULL);
 	/* NOTREACHED */
 	return -1;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 2 Murray Stokely freebsd_committer freebsd_triage 2001-09-24 04:20:42 UTC
Responsible Changed
From-To: freebsd-bugs->murray

I was just looking at this code, so I'll take this one.
Comment 3 Murray Stokely freebsd_committer freebsd_triage 2001-09-30 01:43:56 UTC
State Changed
From-To: open->analyzed

Your change has been committed to -CURRENT, thanks!  There are still 
problems with the restart code.  One problem is that dhclient starts 
but is never killed, so if you restart sysinstall it will try to call 
dhclient again and this will fail.  The routing table also causes 
problems.  For some reasone /var/run/dhclient.pid is not being created 
by dhclient either.  dhclient should be shutdown in the mediaClose 
function for the network device.
Comment 4 Murray Stokely freebsd_committer freebsd_triage 2005-03-18 15:30:43 UTC
Responsible Changed
From-To: murray->freebsd-qa

There is still a valid sysinstall/dhcp interaction issue here, but I'm 
not actively working on it.
Comment 5 Bruce Cran freebsd_committer freebsd_triage 2010-04-25 12:40:27 UTC
Responsible Changed
From-To: freebsd-bugs->brucec

Take.
Comment 6 Bruce Cran freebsd_committer freebsd_triage 2011-01-23 20:59:19 UTC
Responsible Changed
From-To: brucec->freebsd-sysinstall

Back to the pool.
Comment 7 Enji Cooper freebsd_committer freebsd_triage 2015-11-10 09:07:57 UTC
sysinstall has been replaced by bsdinstall in FreeBSD 9.x. Closing.
Comment 8 Enji Cooper freebsd_committer freebsd_triage 2015-11-10 09:12:27 UTC
sysinstall has been replaced by bsdinstall in FreeBSD 9.x. Closing.