Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636215

Re: [PATCH] initramfs: Always do fput() and load modules after rootfs populate

From Stafford Horne <shorne@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] initramfs: Always do fput() and load modules after rootfs populate
Date 2017-05-05 09:50 +0200
Message-ID <tDG9X-798-1@gated-at.bofh.it> (permalink)
References <tDlyx-1Fo-3@gated-at.bofh.it> <tDomK-3tZ-21@gated-at.bofh.it> <tDtZ8-7l4-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 04, 2017 at 07:41:48PM +0100, Al Viro wrote:
> 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.
> 
> Hmm...  Looks like there are two bugs: the older one (from "init, block: try
> to load default elevator module early during boot") that missed the case of
> said module being on built-in initramfs and then flush_delayed_fput() patch
> apparently using that as a marker...
> 
> Frankly, the life would be a lot more convenient if we had the whole
> populate_rootfs() run in userland.  It's using the normal syscalls anyway;
> the only place where it needs more is the access to initramfs images and
> that could be done e.g. by offering one or two file descriptors with
> splice() from those picking those images.  We could build a static binary,
> link _that_ into the kernel and turn the entire thing into "fork a thread,
> write that sucker to rootfs, synchronously close it and do kernel_execve",
> letting everything else (decompression, unpacking, etc.) done in there.
> 
> That was the original plan, actually, and that was the original motivation
> for klibc.  Unfortunately, klibc would have to live in the kernel tree for
> that to work, and that hadn't happened.  Pity, that...
> 
> Anyway, feel free to slap
> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
> on that patch.  I can take it through vfs.git, or either of you could send
> it directly to Linus - up to you.

Hi Al,

Thanks for the review and the background on this.  I could see this would
make it nicer/cleaner to have populate_rootfs() in userland.  But, I guess
if that means adding klibc and keeping this static binary all in tree the
benefits don't outweight the downside of having the extra code and changes.
Do you think it is work revisiting someday?

I have pushed to linus, lets see what he says, if anything.

-Stafford

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs:  finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 09:20 +0200
  Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs:  finish fput() before accessing any binary from initramfs") Lokesh Vutla <lokeshvutla@ti.com> - 2017-05-04 09:50 +0200
    Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs:  finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 10:40 +0200
      Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs:  finish fput() before accessing any binary from initramfs") Lokesh Vutla <lokeshvutla@ti.com> - 2017-05-04 11:20 +0200
        Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs:  finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 11:50 +0200
          [PATCH] initramfs: Always do fput() and load modules after rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-04 14:50 +0200
            Re: [PATCH] initramfs: Always do fput() and load modules after  rootfs populate Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-04 20:50 +0200
              Re: [PATCH] initramfs: Always do fput() and load modules after  rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-05 09:50 +0200
            Re: initramfs: Always do fput() and load modules after rootfs  populate Stafford Horne <shorne@gmail.com> - 2017-05-06 10:20 +0200
              Re: initramfs: Always do fput() and load modules after rootfs  populate Stafford Horne <shorne@gmail.com> - 2017-05-06 10:30 +0200

csiph-web