From patchwork Wed Jan 31 19:32:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Landley X-Patchwork-Id: 10194701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2119360380 for ; Wed, 31 Jan 2018 19:33:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA76828823 for ; Wed, 31 Jan 2018 19:33:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF15F28827; Wed, 31 Jan 2018 19:33:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6402428823 for ; Wed, 31 Jan 2018 19:33:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751435AbeAaTdD (ORCPT ); Wed, 31 Jan 2018 14:33:03 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:33401 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbeAaTdC (ORCPT ); Wed, 31 Jan 2018 14:33:02 -0500 Received: by mail-it0-f67.google.com with SMTP id u12so6958599ite.0 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=k+32Sn/rOFzh5y3oFqpfk+XVtBqUX9LtL1ljxbqxhp0Lbav7rnCAa+SSwdv9NmBwHP 3E1kYrXKjjg5/YeKPZeNRU2BBqN7dLxCZ6TZJtlA1TLuRGkrb30jvRPn0JRcrKbUf6zB QFQDKq/K5llYnUxNFefRhlH9enFSLqgpoxypyHSWxYXPHWhfyuOyFeUjJoOLX5PuKfHa wkIjVMOn3OnGa8XlcwqF0TuMsri07RfSP4AJzHnsNdSSTf5mbayGaAimBuIgVZsdPIZl OHd+esmnDlFXsUDs5+W8oN/FqqZuQOh4kXwpOyde6vcRdKRoUl5v2IOFRFgxrLZA4y+r 8lXQ== X-Gm-Message-State: AKwxytfKU4wE1vz61bC6OBfEUWgjd3tHSTloV6/YqTl1BMcQoeRfPwLp 47f1cfWQGlz9+GtaCOS+nVEbeQ== X-Google-Smtp-Source: AH8x226x9/aUROsQC/56DnGnWwHqNrV1MnbcdILUicEYyqU6uAXqfChYAUrk15zag3br00BE3jaCCA== 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-Language: en-US Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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: (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)... --- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 {