Re: [PATCH RESEND] initramfs: cleanup incomplete rootfs

From: Andy Shevchenko
Date: Fri Feb 15 2019 - 15:13:19 EST


On Tue, Feb 12, 2019 at 3:50 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Tue, Feb 12, 2019 at 2:12 PM David Engraf <david.engraf@xxxxxxxxx> wrote:
> > On 12.02.19 at 11:43, Andy Shevchenko wrote:
> > > On Mon, Feb 11, 2019 at 2:40 PM David Engraf <david.engraf@xxxxxxxxx> wrote:
> > >> On 11.02.19 at 12:40, Andy Shevchenko wrote:
>
> > >> Ok got it. When the memory behind the actual file size is clear (0x0)
> > >> the decompression doesn't complain and just ignores the padding. Any
> > >> other data will be interpreted as a new archive and thus you'll see the
> > >> error message.
> > >
> > > Correct.
> > >
> > >> Is it possible for you to fill the padding after the actual file size
> > >> with 0x00 ?
> > >
> > > Not sure. This is boot loader realm. Even if I patch U-Boot, not every
> > > boot loader will guarantee this.
> > > So, it's fragile to rely on data being 0x00 after actual archive.
> >
> > The problem is that the kernel expects another archive if there are data
> > left. If these data do not contain a valid magic the kernel prints an
> > error message which is correct.
>
> Agree.

JFYI: I had tested your another patch and it prints me the following

[ 20.672873] Initramfs unpacking failed: invalid magic at start of
compressed archive

Nevertheless, I can use the system (since revert of this patch).

> > I could make this error not critical and keep the rootfs, but it's still
> > an error and unexpected.
>
> I would rather call it a warning and continue.
>
> Perhaps something like
>
> static void warning(const char *msg)
> {
> ...print warning...
> return without assigning return value.
> }


--
With Best Regards,
Andy Shevchenko