lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210525141524.3995-4-dong.menglong@zte.com.cn>
Date:   Tue, 25 May 2021 22:15:24 +0800
From:   menglong8.dong@...il.com
To:     mcgrof@...nel.org, josh@...htriplett.org
Cc:     viro@...iv.linux.org.uk, keescook@...omium.org,
        samitolvanen@...gle.com, ojeda@...nel.org, johan@...nel.org,
        bhelgaas@...gle.com, masahiroy@...nel.org,
        dong.menglong@....com.cn, joe@...ches.com, axboe@...nel.dk,
        hare@...e.de, jack@...e.cz, tj@...nel.org,
        gregkh@...uxfoundation.org, song@...nel.org, neilb@...e.de,
        akpm@...ux-foundation.org, f.fainelli@...il.com, arnd@...db.de,
        linux@...musvillemoes.dk, wangkefeng.wang@...wei.com,
        brho@...gle.com, mhiramat@...nel.org, rostedt@...dmis.org,
        vbabka@...e.cz, glider@...gle.com, pmladek@...e.com,
        chris@...isdown.name, ebiederm@...ssion.com, jojing64@...il.com,
        terrelln@...com, geert@...ux-m68k.org, mingo@...nel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        jeyu@...nel.org
Subject: [PATCH v2 3/3] init/do_mounts.c: fix rootfs_fs_type with ramfs

From: Menglong Dong <dong.menglong@....com.cn>

As for the existence of 'user root' which is introduced in previous
patch, 'rootfs_fs_type', which is used as the root of mount tree,
is not used directly any more. So it make no sense to make it tmpfs
while 'INITRAMFS_USER_ROOT' is enabled.

Make 'rootfs_fs_type' ramfs when 'INITRAMFS_USER_ROOT' enabled.

Signed-off-by: Menglong Dong <dong.menglong@....com.cn>
---
 include/linux/init.h |  5 +++++
 init/do_mounts.c     | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/linux/init.h b/include/linux/init.h
index 045ad1650ed1..d65b12fe438c 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -148,7 +148,12 @@ extern unsigned int reset_devices;
 /* used by init/main.c */
 void setup_arch(char **);
 void prepare_namespace(void);
+#ifndef CONFIG_INITRAMFS_USER_ROOT
 void __init init_rootfs(void);
+#else
+static inline void __init init_rootfs(void) { }
+#endif
+
 extern struct file_system_type rootfs_fs_type;
 
 #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2fd168cca480..74f5b0fc8bdf 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -716,7 +716,14 @@ void __init init_user_rootfs(void)
 		}
 	}
 }
-#endif
+
+struct file_system_type rootfs_fs_type = {
+	.name		= "rootfs",
+	.init_fs_context = ramfs_init_fs_context,
+	.kill_sb	= kill_litter_super,
+};
+
+#else
 
 static bool is_tmpfs;
 static int rootfs_init_fs_context(struct fs_context *fc)
@@ -739,3 +746,4 @@ void __init init_rootfs(void)
 		(!root_fs_names || strstr(root_fs_names, "tmpfs")))
 		is_tmpfs = true;
 }
+#endif
-- 
2.32.0.rc0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ