From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbdEQVQT (ORCPT ); Wed, 17 May 2017 17:16:19 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35400 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751782AbdEQVQQ (ORCPT ); Wed, 17 May 2017 17:16:16 -0400 Subject: Re: [PATCHv2] Make initramfs honor CONFIG_DEVTMPFS_MOUNT To: Michael Ellerman , Andrew Morton References: <20170509143132.661c9299d8d5094a09a6059d@linux-foundation.org> <21935caf-501d-e97c-5611-5c4af7e0f9ae@landley.net> <87ziecnnh1.fsf@concordia.ellerman.id.au> Cc: "linux-kernel@vger.kernel.org" , Prarit Bhargava , "Eric W. Biederman" , Yang Shi , Rasmus Villemoes , Kees Cook , Emese Revfy , Petr Mladek , Fabian Frederick From: Rob Landley Message-ID: <72381269-557c-7ba6-a819-e6d136f2dc6c@landley.net> Date: Wed, 17 May 2017 16:16:12 -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: <87ziecnnh1.fsf@concordia.ellerman.id.au> 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/16/2017 10:58 PM, Michael Ellerman wrote: > Rob Landley writes: > >> diff --git a/init/main.c b/init/main.c >> index f866510..9ec09ff 100644 >> --- a/init/main.c >> +++ b/init/main.c >> @@ -1055,8 +1049,17 @@ static noinline void __init kernel_init_freeable(void) >> if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { >> ramdisk_execute_command = NULL; >> prepare_namespace(); >> + } else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) { >> + sys_mkdir("/dev", 0755); >> + devtmpfs_mount("/dev"); >> } >> >> + /* Open the /dev/console on the rootfs, this should never fail */ >> + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) > > Sorry to pile on, The correct phrase is "bikeshed". (It's a verb now.) > but while you're moving it do you want _I_ don't, no. I intentionally moved it unmodified. If you want to submit a patch on top of mine, be my guest. > to update this fairly misleading comment. Define "should". (I'll get the popcorn.) > It definitely can fail, eg. if /dev/console doesn't exist, or if no > console driver is registered. /dev/console not existing in an initramfs created by pointing CONFIG_INITRAMFS_SOURCE at a directory created by a normal user was pretty much my initial motivation for poking at this area, yes. That said, /dev/console should always exist. My patch was just finding a different way for it to exist so the condition was satisfied. Meaning the comment isn't exactly _wrong_, just really terse. Feel free to submit a patch rephrasing it. Rob