[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#903931: [initramfs-tools-core] unmkinitramfs uses "-t" for zcat like it was a "test integrity" option (it's not and it causes crashes)



Package: initramfs-tools-core

Version: 0.130

Severity: normal


--- Please enter the report below this line. ---



The following code fragment is in the xcpio() function of unmkinitramfsunmkinitramfs:

if zcat -t "$archive" >/dev/null 2>&1 ; then
                zcat "$archive"
        elif xzcat -t "$archive" >/dev/null 2>&1 ; then
                xzcat "$archive"
        elif bzip2 -t "$archive" >/dev/null 2>&1 ; then
                bzip2 -c -d "$archive"
        elif lzop -t "$archive" >/dev/null 2>&1 ; then
                lzop -c -d "$archive"



the -t flag used with zcat does not have the same meaning it had with the other programs, xzcat, bzip2 and lzop. With the latter it
means "just do  a test" with the former it is equivalent to -vT (neither -v nor -T means "test"). Now, this causes a strange and
unpredictable behavior of unmkinitramfs (and of lsinitramfs, which uses unmkinitramfs) where for some, not all, initrd files it just aborts its operations with this

free(): invalid next size (normal)

Aborted



Notice that even when it aborts, the "guilty" initrd file is perfectly fine and it can uncrompressed with gunzip or with zcat (without the -t, which, again, it is not the flag for testing the input file).

Solution: remove the -t from "if zcat -t "$archive" >/dev/null 2>&1 ;"



--- System information. ---

Architecture:

Kernel: Linux 4.17.4-cu5


Debian Release: buster/sid

500 unstable ftp.debian.org

500 testing ftp.debian.org

500 stable ftp.debian.org

500 oldstable ftp.debian.org

500 oldoldstable ftp.debian.org

1 experimental ftp.debian.org


--- Package information. ---

Depends (Version) | Installed

===================================-+-==============

klibc-utils (>= 2.0.4-8~) | 2.0.4-11

cpio | 2.12+dfsg-6

kmod | 25-1

OR module-init-tools | 20-1

udev | 239-5



Recommends (Version) | Installed

=====================================-+-===================

busybox (>= 1:1.22.0-17~) | 1:1.27.2-2

OR busybox-static (>= 1:1.22.0-17~) |



Suggests (Version) | Installed

==============================-+-===========

bash-completion | 1:2.8-1


Reply to: