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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <749b6e7c-244e-fdfb-b95c-1803678b8bdc@landley.net>
Date:   Tue, 21 Feb 2023 14:57:52 -0600
From:   Rob Landley <rob@...dley.net>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        "Steven Rostedt (Google)" <rostedt@...dmis.org>,
        "Jason A. Donenfeld" <Jason@...c4.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Mark Rutland <mark.rutland@....com>,
        Mark-PK Tsai <mark-pk.tsai@...iatek.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Li Zhe <lizhe.67@...edance.com>
Subject: [PATCH 3/5] Wire up CONFIG_DEVTMPFS_MOUNT to initramfs.

The kernel has had CONFIG_DEVTMPFS_MOUNT for years, but it only applied to
fallback ROOT= not initramfs/initmpfs. As long as the config option exists,
it might as well work.

I use this for board bringup: populating a chdir and calling cpio as a
normal user often leaves /dev empty (because mknod requires root access),
meaning no /dev/console for init/main.c to open, meaning init runs without
stdin/stdout/stderr and has to mount devtmpfs and redirect the filehandles
blind with no error output if something goes wrong.

Signed-off-by: Rob Landley <rob@...dley.net>
Previously: https://lkml.org/lkml/2017/9/13/651
---
 init/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index e1c3911d7c70..eca7ba2c2764 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1636,7 +1636,6 @@ static noinline void __init kernel_init_freeable(void)
 	kunit_run_all_tests();
 
 	wait_for_initramfs();
-	console_on_rootfs();
 
 	/*
 	 * check if there is an early userspace init.  If yes, let it do all
@@ -1645,7 +1644,11 @@ static noinline void __init kernel_init_freeable(void)
 	if (init_eaccess(ramdisk_execute_command) != 0) {
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
+	} else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) {
+		init_mkdir("/dev", 0755);
+		devtmpfs_mount();
 	}
+	console_on_rootfs();
 
 	/*
 	 * Ok, we have completed the initial bootup, and

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ