From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752395AbdKARJ1 (ORCPT ); Wed, 1 Nov 2017 13:09:27 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:60230 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751402AbdKARJZ (ORCPT ); Wed, 1 Nov 2017 13:09:25 -0400 Date: Wed, 1 Nov 2017 17:09:08 +0000 From: Alan Cox To: Tejun Heo 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: <20171101170908.6ad08580@alans-desktop> In-Reply-To: <20171101020651.GK3252168@devbig577.frc2.facebook.com> References: <20171101020651.GK3252168@devbig577.frc2.facebook.com> Organization: is over-rated X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Alan