From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932980AbdEKRCZ (ORCPT ); Thu, 11 May 2017 13:02:25 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:33576 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932405AbdEKRCX (ORCPT ); Thu, 11 May 2017 13:02:23 -0400 Subject: Re: [PATCH] Make initramfs honor CONFIG_DEVTMPFS_MOUNT To: Andrew Morton References: <20170509143132.661c9299d8d5094a09a6059d@linux-foundation.org> Cc: "linux-kernel@vger.kernel.org" , Prarit Bhargava , Yang Shi , Rasmus Villemoes , Kees Cook , Emese Revfy , Petr Mladek , Fabian Frederick From: Rob Landley Message-ID: Date: Thu, 11 May 2017 12:02:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170509143132.661c9299d8d5094a09a6059d@linux-foundation.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09/2017 04:31 PM, Andrew Morton wrote: > On Thu, 4 May 2017 16:09:06 -0500 Rob Landley wrote: > >> From: Rob Landley >> >> Make initramfs honor CONFIG_DEVTMPFS_MOUNT, and move >> /dev/console open after devtmpfs mount. > > > Could we please see complete description of the runtime effects of this > change? How does it affect users? How does it benefit users? It makes the behavior consistent. If you're going to have the config symbol anyway, why is initramfs a second class citizen? That said, I was fixing a specific bug when I started the patch: when you statically link in an initramfs by pointing the kernel build at a directory (so it makes its own cpio archive from that), if you're not running the build as root you can't create dev/console in there and there's no obvious way to add nodes (like you can editing the gen_initramfs_list) output. This means there's no /dev/console when init gets launched, so PID 1's stdin/stdout/stderr go nowhere, and until your init script can open its own and redirect you get no output if something goes wrong, so debugging is fiddly and there's a hole where output gets lost. Userspace can't close that hole. When making the patch I did a version that mounted /proc /sys and /dev/pts too, so rdinit=/bin/sh had pretty much its full environment without an init script just like the DEVTMPFS_MOUNT option's help text implied... but that seemed unlikely to be accepted. The console gap is a problem userspace can't fix, the rest userspace can, so I did the minimal thing. > The DEVTMPFS_MOUNT Kconfig help (drivers/base/Kconfig) says: > > This option does not affect initramfs based booting, here > the devtmpfs filesystem always needs to be mounted manually > after the rootfs is mounted. > > which seems to no longer be correct? Ah, sorry. I rewrote the help text and didn't include that file in the diff. And rechecking I see the override part wasn't implemented by my patch, I'll send a new one. Rob