Comment 109 for bug 1835660

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

so what grub is doing is correct.

It pads/aligns every initrd by 4, which is fine, and as per spec.

https://www.kernel.org/doc/html/latest/driver-api/early-userspace/buffer-format.html

initramfs size can be filled with arbitrary amount of "\0" all the way upto initramfs_size.

"In human terms, the initramfs buffer contains a collection of compressed and/or uncompressed cpio archives (in the “newc” or “crc” formats); arbitrary amounts zero bytes (for padding) can be added between members."

Thus it feels to me that decompress_unlz4.c method in the kernel does not correctly stop decompressing and returning consumed output position (posp).

For example, decompress_inflate.c skips over trailer and updates output pos by 8, at the end of successful conversion.

Similarly unlzma also updates posp at the end of conversion.