From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10274 invoked by alias); 6 Jul 2011 16:03:47 -0000 Received: (qmail 10266 invoked by uid 22791); 6 Jul 2011 16:03:46 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mpv1.tis.CWRU.Edu (HELO mpv1.tis.cwru.edu) (129.22.105.36) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jul 2011 16:03:32 +0000 Received: from mpv5.cwru.edu (mpv5.tis.CWRU.Edu [129.22.105.51]) by mpv1.tis.cwru.edu (MOS 4.2.3-GA) with ESMTP id BNF25374; Wed, 6 Jul 2011 12:03:30 -0400 Received: from caleb.INS.CWRU.Edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv5.cwru.edu (MOS 4.2.3-GA) with SMTP id AGC78240; Wed, 6 Jul 2011 12:03:32 -0400 Date: Wed, 06 Jul 2011 16:07:00 -0000 From: Chet Ramey To: jan.kratochvil@redhat.com Subject: Re: [Bug-readline] [readline patch, gdb-7.3?] Avoid free from a signal handler [Re: [PATCH] Make interrupting tab-completion safe.] Cc: chet.ramey@case.edu, bug-readline@gnu.org, gdb-patches@sourceware.org, saugustine@google.com, chet@po.cwru.edu Reply-To: chet.ramey@case.edu References: <20110612121158.GA10611@host1.jankratochvil.net> <20110626222146.GA4410@host1.jankratochvil.net> <4E0B2E83.9030202@case.edu> <20110629203457.GA28353@host1.jankratochvil.net> <4E0C8A5D.7000807@case.edu> <20110706154621.GA17142@host1.jankratochvil.net> In-Reply-To: Message from jan.kratochvil@redhat.com of Wed, 6 Jul 2011 17:46:21 +0200 (id <20110706154621.GA17142@host1.jankratochvil.net>) Message-ID: <110706155826.AA07325.SM@caleb.INS.CWRU.Edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020209.4E148752.020B,ss=1,fgs=0, ip=0.0.0.0, so=2010-12-23 16:51:53, dmn=2009-09-10 00:05:08, mode=single engine Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00195.txt.bz2 > On Thu, 30 Jun 2011 16:38:21 +0200, Chet Ramey wrote: > > I have seen cases where the user hits ^C while readline or a filename > > completion function is attempting to traverse a file system on a dead > > NFS server, the signal handler gets hit, but the system call doesn't > > get interrupted. I haven't seen those cases in a while, though. > > I have tried to reproduce it but I think it is outside of the scope of > readline and/or gdb. > > Running > ip6tables -I INPUT 1 -i lo -p tcp --dport 2049 -j DROP > before rl_filename_completion_function's readdir() call will cause (in strace): > > rt_sigaction(SIGINT, {0x6518cb=handle_sigint, [INT], SA_RESTORER|SA_RESTART, 0x7f79cf0bd490}, NULL, 8) = 0 > rt_sigaction(SIGQUIT, {0x65196e=handle_sigquit, [QUIT], SA_RESTORER|SA_RESTART, 0x7f79cf0bd490}, NULL, 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > [...] > getdents(5, > > and no CTRL-C makes any change. It was mounted > on kernel-2.6.35.13-92.fc14.x86_64 with options: > localhost:/... /... nfs ro,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,soft,proto=tcp6,timeo=600,retrans=2,sec=sys,mountaddr=::1,mountvers=3,mountport=59099,mountproto=udp6,addr=::1 0 0 > > where I used "intr" but "intr" / "nointr" is not listed at all and man says: > The intr / nointr mount option is deprecated after kernel 2.6.25. > Only SIGKILL can interrupt a pending NFS operation on these kernels, > and if specified, this mount option is ignored to provide backwards > compatibility with older kernels. Other systems besides Linux still implement the `intr' mount option and allow system calls referencing unresponsive remote file systems to be interrupted (FreeBSD and Mac OS X, for example). I'm willing to accept that bugs in prior versions of these systems have been fixed and the options work as documented. > > remove the references to _rl_interrupt_immediately > > I think _rl_interrupt_immediately should never exist as you cannot do anything > much from the signal handler anyway. > man 7 signak "Async-signal-safe functions" If you believe that you either have no hope (can't interrupt an operation on an unresponsive server) or will get proper EINTR behavior, then you are right. Otherwise, it's your only chance. As I said, I'm willing to remove these references and see what happens. Since you have a way to readily reproduce the problem, I was hoping you'd do it and let me know what you found. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/