From owner-freebsd-bugs Wed Mar 19 2:40:12 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB27937B404 for ; Wed, 19 Mar 2003 02:40:09 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 735A243F3F for ; Wed, 19 Mar 2003 02:40:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h2JAe9NS058076 for ; Wed, 19 Mar 2003 02:40:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h2JAe9S9058075; Wed, 19 Mar 2003 02:40:09 -0800 (PST) Date: Wed, 19 Mar 2003 02:40:09 -0800 (PST) Message-Id: <200303191040.h2JAe9S9058075@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/50100: Ping doesn't handle SIGINT while resolving hosts Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/50100; it has been noted by GNATS. From: Bruce Evans To: Johan Mulder Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/50100: Ping doesn't handle SIGINT while resolving hosts Date: Wed, 19 Mar 2003 21:38:40 +1100 (EST) On Tue, 18 Mar 2003, Johan Mulder wrote: > On Wed, Mar 19, 2003 at 07:13:57AM +1100, Bruce Evans wrote: > > On Wed, 12 Mar 2003, Johan Mulder wrote: > > > >Fix: > > > > > > Fix the signal handler. > > > > The signal handler is not broken. Last time I looked the bug seemed to > > be deep in the resolver library. res_send() retries after EINTR for some > > reason. > > Ok. So then I should do a bug report for res_send I suppose? ;> I think another one is unnecessary. Maxim Konovalov pointed out an old PR about the same bug. The bug seems to be in almost every networking function that checks EINTR. It is a rather silly bug. These functions "know" that they must always restart the select(), poll(), kevent(), accept() and recvfrom() syscalls explicity after a signal is caught because the kernel never does it, but they never restart other syscalls because the kernel "always" does it. However, the kernel actually only restarts other syscalls if SA_RESTART is set for the relevant signal. Restarting some syscalls unconditionally breaks this. I think res_send() needs to restart if and only if the EINTR was for a signal with SA_RESTART clear, but it can't do this because it can't determine anything about the signal except that there was one. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message