From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B9B2C433DF for ; Mon, 27 Jul 2020 06:24:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7497720792 for ; Mon, 27 Jul 2020 06:24:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726272AbgG0GY2 (ORCPT ); Mon, 27 Jul 2020 02:24:28 -0400 Received: from verein.lst.de ([213.95.11.211]:42172 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgG0GY2 (ORCPT ); Mon, 27 Jul 2020 02:24:28 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id C0BE068B05; Mon, 27 Jul 2020 08:24:25 +0200 (CEST) Date: Mon, 27 Jul 2020 08:24:25 +0200 From: Christoph Hellwig To: hpa@zytor.com Cc: Al Viro , Christoph Hellwig , linux-kernel@vger.kernel.org, Song Liu , Linus Torvalds , linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 18/23] init: open code setting up stdin/stdout/stderr Message-ID: <20200727062425.GA2005@lst.de> References: <20200714190427.4332-1-hch@lst.de> <20200714190427.4332-19-hch@lst.de> <20200727030534.GD795125@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sun, Jul 26, 2020 at 11:20:41PM -0700, hpa@zytor.com wrote: > On July 26, 2020 8:05:34 PM PDT, Al Viro wrote: > >On Tue, Jul 14, 2020 at 09:04:22PM +0200, Christoph Hellwig wrote: > >> Don't rely on the implicit set_fs(KERNEL_DS) for ksys_open to work, > >but > >> instead open a struct file for /dev/console and then install it as FD > >> 0/1/2 manually. > > > >I really hate that one. Every time we exposed the internal details to > >the fucking early init code, we paid for that afterwards. And this > >goes over the top wrt the level of details being exposed. > > > >_IF_ you want to keep that thing, move it to fs/file.c, with dire > >comment > >re that being very special shite for init and likely cause of > >subsequent > >trouble whenever anything gets changed, a gnat farts somewhere, etc. > > > > Do not leave that kind of crap sitting around init/*.c; KERNEL_DS > >may be a source of occasional PITA, but here you are trading it for a > >lot > >worse one in the future. > > Okay... here is a perhaps idiotic idea... even if we don't want to run stuff in actual user space, could we map initramfs into user space memory before running init (execing init will tear down those mappings anyway) so that we don't need KERNEL_DS at least? Err, why? The changes have been pretty simple, and I'd rather not come up with new crazy ways just to make things complicated.