Received: by 10.223.176.5 with SMTP id f5csp1788341wra; Wed, 31 Jan 2018 11:34:55 -0800 (PST) X-Google-Smtp-Source: AH8x226wBm9Y4mgCa9P9vas1SUqdaqtnaikT/rhIhW6SkfqVPJNoNVQsJ2dSqMciRsDzHPy/kxMM X-Received: by 2002:a17:902:8545:: with SMTP id d5-v6mr9753265plo.306.1517427295480; Wed, 31 Jan 2018 11:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517427295; cv=none; d=google.com; s=arc-20160816; b=kimiefIm90aguWWgDJC2dLENdxDwzayIDx4MXs4/ilueLlCgoHQ8ts/AvbDMxfx5lF CA5idkJnvF28twNhVVkrUnpv5p+W4r9Fsq5zmEUDtkGM3K9FFS+rxeYDMy1i4lnIx2o3 yiXTygy2fdR161YPTuyh/m+DUT4TWI26Hn6x7T0PuzoTTyPJOAt+ZDRvbTKeDuAeC0tI Cmx8LCOxtbbuA3ikRtBDIlG680zGWN94o/Gpib0Z8GzE6S7qyVRu4HgOoVVe7i3upVgo WRGhcP3QHgfy6ggHxNTj47iJ2f6335DQofe7Cw4UyelxbJ+R0tEzx20tocRAWyiqYrGE 8i9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=fUCE+q2a9Q3nuXgs9/dc7y74ShB6WNngLP0he+GP8dc=; b=wjw/twI2WdJAD5Tk2Aqz6HUk/wA79j/i37Y6boNgUzQ1M9t0AjZUO/KMX93qvXONc9 AI60KlfBFpINEhjx0AUw94dUPcmtiUOdGqU02wVedvPtJwg13EbKDD9p7wW/ICslXiKE vGyHsHIJ4EGeJj1e+WIOz6zOmjKSJ83r4OW+FRkS/EhX2UKctuBWfphMehcwDLuj4jj9 QtzsizuymA/MtlqsMP54fGr0nhSTzuEklKObcNgHscETB5l+wlQ6w1eXY8arRJ+1mVqc h02oUkjE/OXSjflKOFkSQVrEfqEAWl6sky2LNsECWZ32RswOCOk1PqQTD6/AmdXlEpPg 8Z5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@landley-net.20150623.gappssmtp.com header.s=20150623 header.b=evn52Cuv; 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 u142si4011476pgb.529.2018.01.31.11.34.40; Wed, 31 Jan 2018 11:34:55 -0800 (PST) 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; dkim=pass header.i=@landley-net.20150623.gappssmtp.com header.s=20150623 header.b=evn52Cuv; 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 S1751638AbeAaTdD (ORCPT + 99 others); Wed, 31 Jan 2018 14:33:03 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:34419 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeAaTdC (ORCPT ); Wed, 31 Jan 2018 14:33:02 -0500 Received: by mail-it0-f67.google.com with SMTP id m11so6950490iti.1 for ; Wed, 31 Jan 2018 11:33:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=fUCE+q2a9Q3nuXgs9/dc7y74ShB6WNngLP0he+GP8dc=; b=evn52CuvTlU1DczokchmWQRfyfma7SARP1OftYjCmIk9uXHccZ3GkV6hYkBE9oZAU7 jJqHX3a2HbhhnWoBFcT1Hw/jJeJqXXjraTXcx5F789ARCVr3/O0PeIwa4vORxuN//GON DCGF2sp2d9Rv7dk8gaR6PnbpROEYuCUIhhql0EiCu3q06C+0t5xHh5ixVMC+TnTNOIDc QD8YCsU1Ma4ZNHlkm8tNG6l0yNe3k+Iy21BCB4OrZcYCCgO32XH4YtPpQmJUtMCF54DT 1smBiP6N6c//Roddem/eoDm34DsG4t9siPOBPvReT2y5ccuXiE4E5JaZht2YklBrwrPX ld6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fUCE+q2a9Q3nuXgs9/dc7y74ShB6WNngLP0he+GP8dc=; b=JWReKCqUOm/1xoQ5arOLr4V77DbicJgTm9GdYJyBwVrI/PSUCEn8S92EG9ngr0CinV YzNC0yWnFy5FgpgEGrKJYS+hWOeI9WiFb3CNAbOAfn7y6gwTNyaJonzfXW57EEyguZ8s 1okX5IBfuCD25bt82AdArhjN/iZyxDOSQJWswz2iryrKHcHKaba/+U06eWl0upYmaiXk p5Ch4pVkUNeVcotAThXugpg1FUnRaWN626nugXIYZagZvToX3U1oH+J0H5M+UHrjJIJ9 DAdHVndIfW2R5B4wZQ3XwMc8gy0bj7RmLCVVTrNboGZ8FuHX30wjP822mNa+QOhearzM /1Rw== X-Gm-Message-State: AKwxytdY0Ql+cOjpVJvhQWPSTn6vDsDq/3FCTFtN+a7YVGqGby5EIx4V zuMYoLHrkoHgioym1bDKG7FxMDqHSU4= X-Received: by 10.36.211.85 with SMTP id n82mr8520880itg.101.1517427181456; Wed, 31 Jan 2018 11:33:01 -0800 (PST) Received: from [192.168.42.117] ([172.58.120.98]) by smtp.googlemail.com with ESMTPSA id v2sm7668881iob.72.2018.01.31.11.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 11:33:01 -0800 (PST) Subject: Re: [RFC PATCH] rootfs: force mounting rootfs as tmpfs To: Mimi Zohar , initramfs Cc: Taras Kondratiuk , Victor Kamensky , linux-security-module , Al Viro , linux-kernel References: <1517348777.3469.5.camel@linux.vnet.ibm.com> From: Rob Landley Message-ID: <1814af5c-170d-39c0-58fd-02eb7216e008@landley.net> Date: Wed, 31 Jan 2018 13:32:58 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1517348777.3469.5.camel@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30/2018 03:46 PM, Mimi Zohar wrote: > Commit 16203a7a9422 ("initmpfs: make rootfs use tmpfs when CONFIG_TMPFS > enabled") introduced using tmpfs as the rootfs filesystem. The use of > tmpfs is limited to systems that do not specify "root=" on the boot > command line. > > Without the check "!saved_root_name[0]", rootfs uses tmpfs. As there > must be a valid reason for this check, this patch introduces a new boot > command line option named "noramfs" to force rootfs to use tmpfs. > > Signed-off-by: Mimi Zohar How about just: diff --git a/init/do_mounts.c b/init/do_mounts.c index 7cf4f6d..af66ede 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -632,8 +632,8 @@ int __init init_rootfs(void) if (err) return err; - if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] && - (!root_fs_names || strstr(root_fs_names, "tmpfs"))) { + if (IS_ENABLED(CONFIG_TMPFS) && (!saved_root_name[0] || + !strcmp(saved_root_name, "tmpfs"))) { err = shmem_init(); is_tmpfs = true; } else { (Obviously-signed-off-by: Rob Landley ) I.E. if you somehow just can't stop yourself from specifying root= when using rootfs, have "root=tmpfs" do what you want. (The old "I configured in tmpfs and am using rootfs but I want that rootfs to be ramfs, not tmpfs" code doesn't seem to be a real-world concern, does it?) > --- > Documentation/admin-guide/kernel-parameters.txt | 2 ++ > init/do_mounts.c | 15 +++++++++++++-- > 2 files changed, 15 insertions(+), 2 deletions(-) I suppose I should do a documentation update too. Lemme send a proper one after work... Rob P.S. While I'm at it, I've meant to wire up rootflags= so you can specify a memory limit other than 50% forever, I should do that too. And resend my "make DEVTMPFS_MOUNT apply to initramfs" patch (with the debian bug workaround)...