From: Andrei Vagin <avagin@virtuozzo.com>
To: Stafford Horne <shorne@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Lokesh Vutla <lokeshvutla@ti.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: initramfs: Always do fput() and load modules after rootfs populate
Date: Sat, 6 May 2017 00:02:32 -0700 [thread overview]
Message-ID: <20170506070231.GA29268@outlook.office365.com> (raw)
In-Reply-To: <20170504124701.727-1-shorne@gmail.com>
Hi,
I see the following error with this patch:
init/initramfs.c: In function 'populate_rootfs':
init/initramfs.c:644:2: error: label at end of compound statement
done:
^
scripts/Makefile.build:294: recipe for target 'init/initramfs.o' failed
make[1]: *** [init/initramfs.o] Error 1
probably we need something like this:
diff --git a/init/initramfs.c b/init/initramfs.c
index 3a68715..9966c0f 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -641,7 +641,6 @@ static int __init populate_rootfs(void)
sys_close(fd);
free_initrd();
}
- done:
#else
printk(KERN_INFO "Unpacking initramfs...\n");
err = unpack_to_rootfs((char *)initrd_start,
@@ -651,6 +650,7 @@ static int __init populate_rootfs(void)
free_initrd();
#endif
}
+done:
flush_delayed_fput();
/*
* Try loading default modules from initramfs. This gives
Thanks,
Andrei
On Thu, May 04, 2017 at 09:47:00PM +0900, Stafford Horne wrote:
> In OpenRISC we do not have a bootloader passed initrd, but the built in
> initramfs does contain the /init and other binaries, including modules.
> The previous commit 08865514805d2 ("initramfs: finish fput() before
> accessing any binary from initramfs") made a change to only call fput()
> if the bootloader initrd was available, this caused intermittent crashes
> for OpenRISC.
>
> This patch changes the fput() to happen unconditionally if any rootfs is
> loaded. Also, I added some comments to make it a bit more clear why we
> call unpack_to_rootfs() multiple times.
>
> Fixes: 08865514805d2 ("initramfs: finish fput() before accessing any binary from initramfs")
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Stafford Horne <shorne@gmail.com>
> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> init/initramfs.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/init/initramfs.c b/init/initramfs.c
> index 981f286..3a68715 100644
> --- a/init/initramfs.c
> +++ b/init/initramfs.c
> @@ -608,9 +608,11 @@ static void __init clean_rootfs(void)
>
> static int __init populate_rootfs(void)
> {
> + /* Load the built in initramfs */
> char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
> if (err)
> panic("%s", err); /* Failed to decompress INTERNAL initramfs */
> + /* If available load the bootloader supplied initrd */
> if (initrd_start) {
> #ifdef CONFIG_BLK_DEV_RAM
> int fd;
> @@ -648,13 +650,14 @@ static int __init populate_rootfs(void)
> printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
> free_initrd();
> #endif
> - flush_delayed_fput();
> - /*
> - * Try loading default modules from initramfs. This gives
> - * us a chance to load before device_initcalls.
> - */
> - load_default_modules();
> }
> + flush_delayed_fput();
> + /*
> + * Try loading default modules from initramfs. This gives
> + * us a chance to load before device_initcalls.
> + */
> + load_default_modules();
> +
> return 0;
> }
> rootfs_initcall(populate_rootfs);
next prev parent reply other threads:[~2017-05-06 7:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 7:11 [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Stafford Horne
2017-05-04 7:45 ` Lokesh Vutla
2017-05-04 8:35 ` Stafford Horne
2017-05-04 9:09 ` Lokesh Vutla
2017-05-04 9:41 ` Stafford Horne
2017-05-04 12:47 ` [PATCH] initramfs: Always do fput() and load modules after rootfs populate Stafford Horne
2017-05-04 18:41 ` Al Viro
2017-05-05 7:43 ` Stafford Horne
2017-05-06 7:02 ` Andrei Vagin [this message]
2017-05-06 8:17 ` Stafford Horne
2017-05-06 8:23 ` Stafford Horne
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=20170506070231.GA29268@outlook.office365.com \
--to=avagin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lokeshvutla@ti.com \
--cc=shorne@gmail.com \
--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®