mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Lillian Berry <lillian@star-ark.net>
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible
Date: Sun, 6 Jul 2025 15:32:39 -0700	[thread overview]
Message-ID: <20250706153239.3be93aee4b0c8d43e025bd85@linux-foundation.org> (raw)
In-Reply-To: <20250706205738.1312194-1-lillian@star-ark.net>

On Sun,  6 Jul 2025 20:57:38 +0000 Lillian Berry <lillian@star-ark.net> wrote:

> Avoid silently ignoring the initramfs when the file specified in rdinit
> is not usable. This prints an error that clearly explains the issue
> (file was not found, vs initramfs was not found).
> 
> ...
>
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1592,7 +1592,10 @@ static noinline void __init kernel_init_freeable(void)
>  	 * check if there is an early userspace init.  If yes, let it do all
>  	 * the work
>  	 */
> -	if (init_eaccess(ramdisk_execute_command) != 0) {
> +	int ramdisk_command_access = init_eaccess(ramdisk_execute_command);

hm, the C99-style definition is acceptable nowadays, but is rarely used.

> +	if (ramdisk_command_access != 0) {
> +		pr_warn("rdinit=%s is inaccessible or does not exist (errno %i), ignoring\n",
> +			ramdisk_execute_command, ramdisk_command_access);

Again, I don't think we should assume (or say) "inaccessible or does not
exist".  After all, init_eaccess() could have returned -ENOMEM. 
Something like "access(%s) failed: %d", maybe.

  reply	other threads:[~2025-07-06 22:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06 20:57 Lillian Berry
2025-07-06 22:32 ` Andrew Morton [this message]
2025-07-07  7:47   ` Lillian Berry

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=20250706153239.3be93aee4b0c8d43e025bd85@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=lillian@star-ark.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®