Subject: bin/20369: inetd can not be "kill"'d in default config
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@aprisoft.de>
List: netbsd-bugs
Date: 02/16/2003 17:06:13
>Number: 20369
>Category: bin
>Synopsis: inetd can not be "kill"'d in default config
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 16 08:07:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Martin Husemann
>Release: NetBSD 1.6N
>Organization:
>Environment:
System: NetBSD sunny-weather.duskware.de 1.6N NetBSD 1.6N (SUNNY) #1: Sun Feb 16 01:10:15 CET 2003 martin@sunny-weather.duskware.de:/usr/src/sys/arch/sparc64/compile/SUNNY sparc64
Architecture: sparc64
Machine: sparc64
>Description:
In the default configuration we ship /etc/inetd.conf has no services enabled.
Nevertheless we start inetd, to make it easier for users to add services.
In this configuration (no active inetd.conf services), the resent kevent
signal changes to inetd break it.
>How-To-Repeat:
Use the inetd.conf from our default distribution.
Run /etc/rc.d/inetd stop.
Watch it fail to kill the same pid over and over.
Using "pkill -ABRT inetd" works.
>Fix:
I'm not sure I understand the logic, but it certainly has flaws:
In inetd.c:521ff:
if (nsock == 0) {
(void) sigblock(SIGBLOCK);
while (nsock == 0)
sigpause(0L);
(void) sigsetmask(0L);
}
The program blocks in sigpause(0L). It already has SIG_IGN'd all relevant
signals, but in this situation will never be able to proceed to the
my_kevent() call a few lines further down, where it would (correctly)
handle the SIGINT event.
Removing this code block should fix it, but I'm not sure if it is the right
thing to do, since this is obviously some optimization I fail to understand.
Maybe unblock the signals before calling sigpause() and block it again
when it returns?
>Release-Note:
>Audit-Trail:
>Unformatted: