Received: by 10.223.176.5 with SMTP id f5csp518570wra; Tue, 30 Jan 2018 15:23:16 -0800 (PST) X-Google-Smtp-Source: AH8x225KmhJgvnmxvyTyYG3HLQTPFwJnvJm12/aPrWfa6YNpVkGy2fzZ1WKbaWRjxmKn7l4k7XRx X-Received: by 2002:a17:902:7b81:: with SMTP id w1-v6mr3668884pll.295.1517354596651; Tue, 30 Jan 2018 15:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517354596; cv=none; d=google.com; s=arc-20160816; b=b+8TJVHGXHSwP8a62I0IoQNoWfmrraHhS5s7EFySUsGC7aQcOhWhHTJ2ZdAa42d6ZB BtFOlaRrQWtHUzuJkCwa3y4g2AIhOrFYwu1LfQh4OxyDYSW90EGjWDcOQeSE7KFSu764 fQ3CCVGGDmIuyQsXVd8iTrUiDE3BHica+wcpugz+r4rl6nbbh4qr0T9QScQAp5vz3KBf yXm4LqdOBICaRsvp0m5eV+EnDZaWap4wqSDxDmAUbkkogZexRS4XeLAhZbWeCshD19Ch 36+UhA1gPJb1G5cbgYVsnMMt5rZrwCch6TkyzDzmc/yU49tKhGtxd+3tfvMSCI8zHzf3 rUrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:cc:to:from:subject:arc-authentication-results; bh=1KRl6o4HjE5r2cOm6ty0/tAPqYwHcJOeluM6lD4ecPQ=; b=QUhoIyFyhR1DDoT/hn4Jo/wxID/ZOBrmcsAblN4zSbTWm8rxjsdM58/Akai/+dRv20 wbxtN4DpTejtIZuOE9BFaNI4rs75446kcP6c2Y57YwD0FdStz4jWk8UR1QhVhmkuXPWX E+x/2kx+theigjgEE1YHrvRT6WBplWdVWeGl7y4yjDOYE4cno32hKS2wQ/nJvdqS5Ewe ocVu0fL7o5tqmW4gwg/BCxc8MGQJB2urSpMAxQ7PWGg/bZ7UCoehQKMCwaQpk9HCfekE SA2xhIO0zTMdkSOb8GExJpkP41Qf1Ta8+EAFvTkYAmZMNhADVTOmsHpf3gYo7sF04Cu1 VgVg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11si3162247pgp.624.2018.01.30.15.23.02; Tue, 30 Jan 2018 15:23:16 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752940AbeA3Vq0 (ORCPT + 99 others); Tue, 30 Jan 2018 16:46:26 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38534 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751741AbeA3VqY (ORCPT ); Tue, 30 Jan 2018 16:46:24 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0ULiC4K067505 for ; Tue, 30 Jan 2018 16:46:24 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fu0tc07t2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 Jan 2018 16:46:23 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Jan 2018 21:46:22 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Jan 2018 21:46:19 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0ULkIAO49676290; Tue, 30 Jan 2018 21:46:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C95942045; Tue, 30 Jan 2018 21:39:26 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CFE04203F; Tue, 30 Jan 2018 21:39:25 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.103.236]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 30 Jan 2018 21:39:25 +0000 (GMT) Subject: [RFC PATCH] rootfs: force mounting rootfs as tmpfs From: Mimi Zohar To: initramfs Cc: Taras Kondratiuk , Victor Kamensky , Rob Landley , linux-security-module , Al Viro , linux-kernel Date: Tue, 30 Jan 2018 16:46:17 -0500 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18013021-0008-0000-0000-000004C7A200 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18013021-0009-0000-0000-00001E5B39A2 Message-Id: <1517348777.3469.5.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-30_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801300265 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ init/do_mounts.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 6571fbfdb2a1..fd82df2ff150 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2733,6 +2733,8 @@ nopcid [X86-64] Disable the PCID cpu feature. + noramfs Don't use ramfs for rootfs, use tmpfs. + norandmaps Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space diff --git a/init/do_mounts.c b/init/do_mounts.c index 7cf4f6dafd5f..74d8bfcd1294 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -315,6 +315,16 @@ static int __init root_data_setup(char *str) return 1; } +static bool force_tmpfs; +static int __init force_tmpfs_setup(char *str) +{ + if (*str) + return 0; + force_tmpfs = true; + return 1; + +} + static char * __initdata root_fs_names; static int __init fs_names_setup(char *str) { @@ -332,6 +342,7 @@ static int __init root_delay_setup(char *str) __setup("rootflags=", root_data_setup); __setup("rootfstype=", fs_names_setup); __setup("rootdelay=", root_delay_setup); +__setup("noramfs", force_tmpfs_setup); static void __init get_fs_names(char *page) { @@ -632,8 +643,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) && (force_tmpfs || (!saved_root_name[0] && + (!root_fs_names || strstr(root_fs_names, "tmpfs"))))) { err = shmem_init(); is_tmpfs = true; } else { -- 2.7.5