Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp200530yba; Wed, 3 Apr 2019 07:12:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkTJNpKbqk4kVQmJ0NqCtG9kfH7RPREUFB8PqGyocA+sns4t3x5fZjJMKZVJcK8tH+wjZB X-Received: by 2002:a17:902:8d8b:: with SMTP id v11mr77961plo.133.1554300747915; Wed, 03 Apr 2019 07:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554300747; cv=none; d=google.com; s=arc-20160816; b=rOp6zwsWorklFoayF3OsvvoLh7mALcBbt+kwej80i1X+oDmiflfDHb0YqDWu0TnK2D Pb02upYlqH3NvlaaNPzb7RUgMpsm2URMwRZ66lur6mh8lbjWnMrvQ7Nd7vkmoQrZ6O5+ NLLDzFdzlQAYhDI5QEC6XohMa2RjUYwh3zZGUitzGn6aEym+CSCRuUOClMaXLydaxdQH XJKzvFkAM+SMsuw2mQ4dYF4msbNoZM/t2E62Ny6cjmxDHRXYnJ1PpVTeEggoIwdYjK+5 r8pbI9Ow/PG2md5f76mIa0JFmBklEyPKs8aqFsG1rGBOYKJroJq42aWBsTVwYKbN5ayq V56A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rtiPaMWi3E0mX/5Z80FV6f5X6FDC4hB+2WbfaK3CoV0=; b=QJTmn7pEmQXiVfbC4nkXV541FYrOTVzs4DAnM2FzFdYa1dxtSo+DKxlLhOccwfFsZP 1rGZjK0LbkCvRWTmnzRixHj5xzjhx49Z4wmNZR/d833DW+tnLstONNOvLCDx7ITN+JgE uZyyrvZ++t51CqMn4k4D5WsJRje3027nKnrKjACsoNdjR/wBKoU8my893ZpBqDsA/Jme F2Xel6drxpJZ75UDV5LbtEhEWGxVTf2yB0oya4RBZ4+Kn7VnI859xsUfkKJgnwwkI9bW TfEkgj6sPlE79yT21wtfxUolEJm+cR4L/3crKoo85A0tcunhB3KF+GPPO7OaCLgut26a Q2ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o19si14014695pgh.409.2019.04.03.07.12.11; Wed, 03 Apr 2019 07:12:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726409AbfDCOLN (ORCPT + 99 others); Wed, 3 Apr 2019 10:11:13 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:33114 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbfDCOLM (ORCPT ); Wed, 3 Apr 2019 10:11:12 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id DD952185BD; Wed, 3 Apr 2019 16:11:10 +0200 (CEST) X-Axis-User: NO X-Axis-NonUser: YES X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id gN1XOjtXSmBj; Wed, 3 Apr 2019 16:11:10 +0200 (CEST) Received: from boulder03.se.axis.com (boulder03.se.axis.com [10.0.8.17]) by bastet.se.axis.com (Postfix) with ESMTPS id C57D0185EB; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACE3D1E06A; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A15561E066; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Received: from seth.se.axis.com (unknown [10.0.2.172]) by boulder03.se.axis.com (Postfix) with ESMTP; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Received: from lnxartpec.se.axis.com (lnxartpec.se.axis.com [10.88.4.9]) by seth.se.axis.com (Postfix) with ESMTP id 9514F2720; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Received: by lnxartpec.se.axis.com (Postfix, from userid 10564) id 8F80680D28; Wed, 3 Apr 2019 16:11:09 +0200 (CEST) Date: Wed, 3 Apr 2019 16:11:09 +0200 From: Vincent Whitchurch To: Greg KH Cc: jslaby@suse.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tty: Add NULL TTY driver Message-ID: <20190403141109.3mdmqbt3mjxrie6k@axis.com> References: <20190403113327.3628-1-vincent.whitchurch@axis.com> <20190403131213.GA4246@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190403131213.GA4246@kroah.com> User-Agent: NeoMutt/20170113 (1.7.2) X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 03:12:13PM +0200, Greg KH wrote: > On Wed, Apr 03, 2019 at 01:33:27PM +0200, Vincent Whitchurch wrote: > > If no console driver is enabled (or if a non-present driver is selected > > with something like console=null in an attempt to disable the console), > > opening /dev/console errors out, and init scripts and other userspace > > code that relies on the existence of a console will fail. Symlinking > > /dev/null to /dev/console does not solve the problem since /dev/null > > does not behave like a real TTY. > > > > To just provide a dummy console to userspace when no console driver is > > available or desired, add a ttynull driver which simply discards all > > writes. It can be chosen on the command line in the standard way, i.e. > > with console=ttynull. > > If they have a broken system that sets "console=null", why would they > know to fix it to be "console=ttynull"? > > I'm all for adding new functionality, but to provide kernel code because > userspace just isn't configured properly, that feels really wrong to me. Especially on embedded systems, it would be convenient to have a simple way to disable the console (both for kernel and userspace) on a system which normally uses it, to free up the UART for other things. In my case some early init script in userspace was actually tring to handle the lack of a console in this way: [ ! -w /dev/console ] || exec 2>/dev/console but the problem is that /dev/console always exists but fails on write, so the obvious way of handling missing devices doesn't work. AFAICS the only way to get rid of /dev/console would be to disable the TTY layer entirely in the kernel or have early userspace delete the file from devtmpfs. > Now if this were to be the "default" if nothing is set up at all, that > might make a bit more sense, but as-is, this doesn't seem very useful. Making it the default now would break users, wouldn't it? Since IIRC if no console is selected, the first registered console will automatically be used by default.