* [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible
@ 2025-07-06 20:57 Lillian Berry
2025-07-06 22:32 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Lillian Berry @ 2025-07-06 20:57 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, viro, Lillian Berry
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).
Signed-off-by: Lillian Berry <lillian@star-ark.net>
---
init/main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 225a58279acd..84090c2099ff 100644
--- 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);
+ 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);
ramdisk_execute_command = NULL;
prepare_namespace();
}
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible
2025-07-06 20:57 [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible Lillian Berry
@ 2025-07-06 22:32 ` Andrew Morton
2025-07-07 7:47 ` Lillian Berry
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2025-07-06 22:32 UTC (permalink / raw)
To: Lillian Berry; +Cc: linux-kernel, viro
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible
2025-07-06 22:32 ` Andrew Morton
@ 2025-07-07 7:47 ` Lillian Berry
0 siblings, 0 replies; 3+ messages in thread
From: Lillian Berry @ 2025-07-07 7:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Al Viro
On Sun, Jul 6, 2025, at 6:32 PM, Andrew Morton wrote:
>> + 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.
Sorry, I must've misunderstood your previous mail. I'll change the
message to be more generic.
Kindly,
Lillian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-07 7:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-06 20:57 [PATCH v2] init/main.c: add warning when file specified in rdinit is inaccessible Lillian Berry
2025-07-06 22:32 ` Andrew Morton
2025-07-07 7:47 ` Lillian Berry
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®