Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754738AbbBQWfU (ORCPT ); Tue, 17 Feb 2015 17:35:20 -0500 Received: from mail-qg0-f46.google.com ([209.85.192.46]:54588 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754704AbbBQWfP (ORCPT ); Tue, 17 Feb 2015 17:35:15 -0500 Message-ID: <54E3C21E.3000301@hurleysoftware.com> Date: Tue, 17 Feb 2015 17:35:10 -0500 From: Peter Hurley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Aristeu Rozanski CC: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby Subject: Re: [PATCH] n_tty_read: check for hanging tty while waiting for input References: <20150217210609.GA13666@redhat.com> <54E3B27E.9020506@hurleysoftware.com> <20150217215046.GC13666@redhat.com> In-Reply-To: <20150217215046.GC13666@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1814 Lines: 45 Hi Aristeu, On 02/17/2015 04:50 PM, Aristeu Rozanski wrote: > Hi Peter, > On Tue, Feb 17, 2015 at 04:28:30PM -0500, Peter Hurley wrote: >> On 02/17/2015 04:06 PM, Aristeu Rozanski wrote: >>> If the console has a canonical reader and the respective tty hangs up, >>> it'll waste a wake up and will never release the last ldisc reference so >>> the hangup process can finish: >> >> This behavior is by-design; /dev/console cannot be hung-up. > > hangup is issued on the tty that happens to be the console. In this > case, ttyS0. I realize that. But hanging up the tty that is /dev/console only affects open descriptors that are not /dev/console. So readers using the /dev/ttyS0 file descriptor will see a hungup fops, but readers using /dev/console will not, and /dev/ttyS0 will _not_ be closed or released because of the still-open descriptor on /dev/console. >> What process is sleeping on /dev/console read() and what is its controlling >> tty? I ask because console teardown usually happens when SIGHUP is >> received by the process group. > > ttyS0 is the controller tty. Ok, so the process sleeping on /dev/console read() should have received SIGHUP, which would wake the process and cause it to exit the n_tty_read() loop, thus dropping the ldisc reference it holds. Did it ignore the signal or perhaps the signal is masked? Of course, there is no requirement for the process sleeping on /dev/console to respond to SIGHUP, in which case, the hangup simply fails to make forward progress because of the open /dev/console descriptor. Regards, Peter Hurley -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/