[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJvmJZSRfiHN19e_wx9c=DW2yb19apQU05R22hRfDtsKQ@mail.gmail.com>
Date: Thu, 4 May 2017 16:34:47 -0700
From: Kees Cook <keescook@...omium.org>
To: Rob Landley <rob@...dley.net>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Prarit Bhargava <prarit@...hat.com>,
Yang Shi <yang.shi@...aro.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Emese Revfy <re.emese@...il.com>,
Petr Mladek <pmladek@...e.com>,
Fabian Frederick <fabf@...net.be>
Subject: Re: [PATCH] Make initramfs honor CONFIG_DEVTMPFS_MOUNT
On Thu, May 4, 2017 at 2:09 PM, Rob Landley <rob@...dley.net> wrote:
> From: Rob Landley <rob@...dley.net>
>
> Make initramfs honor CONFIG_DEVTMPFS_MOUNT, and move
> /dev/console open after devtmpfs mount.
>
> Signed-off-by: Rob Landley <rob@...dley.net>
Seems sensible.
Reviewed-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
>
> init/main.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/init/main.c b/init/main.c
> index 2858be7..71ed0d7 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1016,12 +1016,6 @@ static noinline void __init kernel_init_freeable(void)
>
> do_basic_setup();
>
> - /* Open the /dev/console on the rootfs, this should never fail */
> - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
> - pr_err("Warning: unable to open an initial console.\n");
> -
> - (void) sys_dup(0);
> - (void) sys_dup(0);
> /*
> * check if there is an early userspace init. If yes, let it do all
> * the work
> @@ -1033,8 +1027,17 @@ static noinline void __init kernel_init_freeable(void)
> if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
> ramdisk_execute_command = NULL;
> prepare_namespace();
> + } else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) {
> + sys_mkdir("/dev", 0755);
> + sys_mount("dev", "dev", "devtmpfs", MS_SILENT, NULL);
> }
>
> + /* Open the /dev/console on the rootfs, this should never fail */
> + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
> + pr_err("Warning: unable to open an initial console.\n");
> + (void) sys_dup(0);
> + (void) sys_dup(0);
> +
> /*
> * Ok, we have completed the initial bootup, and
> * we're essentially up and running. Get rid of the
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists