All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Richard Weinberger <richard@nod.at>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	a.p.zijlstra@chello.nl, mingo@elte.hu, xiyou.wangcong@gmail.com
Subject: Re: [PATCH] init: Warn on non-existent rdinit
Date: Thu, 05 Jan 2012 12:53:29 -0800	[thread overview]
Message-ID: <m14nw9c1me.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <1325789819-30502-1-git-send-email-richard@nod.at> (Richard Weinberger's message of "Thu, 5 Jan 2012 19:56:59 +0100")

Richard Weinberger <richard@nod.at> writes:

> Such a warning would have saved me some time...
> Hopefully this printk() saves someone else's time. :-)

The warning is wrong if you are not using an initramfs or an initial
ramdisk.

I expect what you want is something like:

diff --git a/init/main.c b/init/main.c
index 217ed23..8d53d28 100644
--- a/init/main.c
+++ b/init/main.c
@@ -830,10 +830,11 @@ static int __init kernel_init(void * unused)
         * the work
         */
 
-       if (!ramdisk_execute_command)
+       if (!ramdisk_execute_command &&
+           (sys_access((const char __user *)"/init", 0) == 0))
                ramdisk_execute_command = "/init";
 
-       if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
+       if (!ramdisk_execute_command) {
                ramdisk_execute_command = NULL;
                prepare_namespace();
        }


That way we don't clear ramdisk_execute_command if it was set and
we complain if we attempt exec the ramdisk_execute_command.

Eric

  reply	other threads:[~2012-01-05 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 18:56 [PATCH] init: Warn on non-existent rdinit Richard Weinberger
2012-01-05 20:53 ` Eric W. Biederman [this message]
2012-01-05 21:45   ` Richard Weinberger
2012-01-05 22:00     ` Eric W. Biederman
2012-01-05 22:03       ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14nw9c1me.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richard@nod.at \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.