Re: [PATCH RESEND] initramfs: cleanup incomplete rootfs

From: David Engraf
Date: Mon Feb 11 2019 - 02:56:38 EST

On 09.02.19 at 11:35, Andy Shevchenko wrote:
On Sat, Feb 9, 2019 at 12:08 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
On Fri, 8 Feb 2019 21:45:21 +0200 Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
On Tue, Oct 30, 2018 at 5:22 PM David Engraf <david.engraf@xxxxxxxxx> wrote:

Unpacking an external initrd may fail e.g. not enough memory. This leads
to an incomplete rootfs because some files might be extracted already.
Fixed by cleaning the rootfs so the kernel is not using an incomplete

This breaks my setup where I have U-boot provided more size of
initramfs than needed. This allows a bit of flexibility to increase or
decrease initramfs compressed image without taking care of bootloader.
The proper solution is to do this if we sure that we didn't get enough
memory, otherwise I can't consider the error fatal to clean up rootfs.

OK, thanks. Maybe David can suggest a fix - I'll queue up a revert

I don't really understand the failure. Why does an oversized initramfs
cause unpack_to_rootfs() to fail?

In my case I have got "Junk in compressed archive". I don't know (I
would check if needed) which exact condition I got since there are
three places with this message. The file itself smaller than the size
passed through bootparam. So, when decomression is finished
(successfully!) we still have a garbarge in the memory which is not
related to archive. Message per se is okay to have, though I consider
this non-fatal.

I can reproduce this special case. The unpacking decompresses the whole size instead of checking the archive size. I will have a look how to get the real archive size.

Best regards
- David