From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753537AbdKFOyi (ORCPT ); Mon, 6 Nov 2017 09:54:38 -0500 Received: from mail-qk0-f170.google.com ([209.85.220.170]:46948 "EHLO mail-qk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbdKFOyg (ORCPT ); Mon, 6 Nov 2017 09:54:36 -0500 X-Google-Smtp-Source: ABhQp+RCZouAb39Fq4qa14qkSHHX4uBdzkT7knw/W2lDFqlZQLw54ppLl6n7QnajSBuk6sff1t/fyw== Date: Mon, 6 Nov 2017 06:54:27 -0800 From: Tejun Heo To: Alan Cox Cc: Greg Kroah-Hartman , Jiri Slaby , Linus Torvalds , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [BUG] tty: Userland can create hung tasks Message-ID: <20171106145415.GW3252168@devbig577.frc2.facebook.com> References: <20171101020651.GK3252168@devbig577.frc2.facebook.com> <20171101170908.6ad08580@alans-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171101170908.6ad08580@alans-desktop> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Alan. On Wed, Nov 01, 2017 at 05:09:08PM +0000, Alan Cox wrote: > On Tue, 31 Oct 2017 19:06:51 -0700 > Tejun Heo wrote: > > > Hello, > > > > tty hangup code doesn't mark the console as being HUPed for, e.g., > > /dev/console and that can put the session leader trying to > > disassociate from the controlling terminal in an indefinite D sleep. > > > > Looking at the code, I have no idea why some tty devices are never > > marked being hung up. It *looks* intentional and dates back to the > > git origin but I couldn't find any clue. The following patch is a > > workaround which fixes the observed problem but definitely isn't the > > proper fix. > > Two reasons > > 1. It broke the serial consoles because they would hang up and close down > the hardware. With tty_port that *should* be fixable properly for any > cases remaining. > > 2. The console layer was (and still is) completely broken and doens't > refcount properly. So if you turn on console hangups it breaks (as indeed > does freeing consoles and half a dozen other things). > > Sadly it seems that nobody cares about the console. Hmm... so, does something like the posted workaround look reasonable to you? It doesn't fix the actual hangup issue but gets rid of processes getting stuck in D sleep indefinitely. Thanks. -- tejun