speed47 / spectre-meltdown-checker

Reptar, Downfall, Zenbleed, ZombieLoad, RIDL, Fallout, Foreshadow, Spectre, Meltdown vulnerability/mitigation checker for Linux & BSD
3.87k stars 476 forks source link

XZ-compressed kernel: "kernel compression format is unknown" #439

Closed srcshelton closed 1 year ago

srcshelton commented 2 years ago

Running from a container-image with podman:

+ podman run --privileged --rm --volume /boot:/boot:ro --volume /dev/cpu:/dev/cpu:ro --volume /lib/modules:/lib/modules:ro spectre-meltdown-checker --kernel /boot/kernel-5.18.12-gentoo --config /boot/config-5.18.12-gentoo --map /boot/System.map-5.18.12-gentoo -v -v
Spectre and Meltdown mitigation detection tool v0.45

(debug) cpuid: leaf1 subleaf0 on cpu0, eax-ebx-ecx-edx:      329443    1050624 2147154943 3219913727
(debug) cpuid: wanted register (1) has value 329443 aka 000506e3
(debug) cpuid: shifted value by 0 is 329443 aka 506e3
(debug) cpuid: after AND 0xFFFFFFFF, final value is 329443 aka 506e3
Checking for vulnerabilities against specified kernel
CPU is Intel(R) Xeon(R) CPU E3-1240L v5 @ 2.10GHz
Will use kernel image /boot/kernel-5.18.12-gentoo
Will use kconfig /boot/config-5.18.12-gentoo
Will use System.map file /boot/System.map-5.18.12-gentoo
(debug) check_kernel: ret=0 size=6791200 sections=0 warnings=readelf: Error: Not an ELF file - it has the wrong magic bytes at the start/
(debug) check_kernel: ... file is invalid
(debug) extract_kernel: pass 1 normal mode
(debug) try_decompress: looking for gunzip magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for gunzip found at offset 738873:xy
(debug) try_decompress: decompression with gunzip failed (err=1)
(debug) try_decompress: looking for lz4 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unxz magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unxz found at offset 16297:abcde
(debug) try_decompress: decompression with unxz failed (err=1)
(debug) try_decompress: looking for bunzip2 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unlzma magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unlzma found at offset 1176:xxx
(debug) try_decompress: decompression with unlzma failed (err=1)
(debug) try_decompress: looking for lzop magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for cat magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unzstd magic in /boot/kernel-5.18.12-gentoo
(debug) extract_kernel: pass 1 desperate mode
(debug) try_decompress: looking for gunzip magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for gunzip found at offset 738873:xy
(debug) try_decompress: decompression with gunzip failed (err=1)
(debug) try_decompress: looking for lz4 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unxz magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unxz found at offset 16297:abcde
(debug) try_decompress: decompression with unxz failed (err=1)
(debug) try_decompress: looking for bunzip2 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unlzma magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unlzma found at offset 1176:xxx
(debug) try_decompress: decompression with unlzma failed (err=1)
(debug) try_decompress: looking for lzop magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for cat magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unzstd magic in /boot/kernel-5.18.12-gentoo
(debug) extract_kernel: pass 2 normal mode
(debug) try_decompress: looking for gunzip magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for gunzip found at offset 738873:xy
(debug) try_decompress: decompression with gunzip failed (err=1)
(debug) try_decompress: looking for lz4 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unxz magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unxz found at offset 16297:abcde
(debug) try_decompress: decompression with unxz failed (err=1)
(debug) try_decompress: looking for bunzip2 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unlzma magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unlzma found at offset 1176:xxx
(debug) try_decompress: decompression with unlzma failed (err=1)
(debug) try_decompress: looking for lzop magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for cat magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unzstd magic in /boot/kernel-5.18.12-gentoo
(debug) extract_kernel: pass 2 desperate mode
(debug) try_decompress: looking for gunzip magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for gunzip found at offset 738873:xy
(debug) try_decompress: decompression with gunzip failed (err=1)
(debug) try_decompress: looking for lz4 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unxz magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unxz found at offset 16297:abcde
(debug) try_decompress: decompression with unxz failed (err=1)
(debug) try_decompress: looking for bunzip2 magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unlzma magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: magic for unlzma found at offset 1176:xxx
(debug) try_decompress: decompression with unlzma failed (err=1)
(debug) try_decompress: looking for lzop magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for cat magic in /boot/kernel-5.18.12-gentoo
(debug) try_decompress: looking for unzstd magic in /boot/kernel-5.18.12-gentoo
Couldn't extract the kernel image (kernel compression format is unknown or image is invalid), accuracy might be reduced
$ zgrep KERNEL_XZ /proc/config.gz 
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_KERNEL_XZ=y
$ file /boot/kernel-5.18.12-gentoo
/boot/kernel-5.18.12-gentoo: Linux kernel x86 boot executable bzImage, version 5.18.12-gentoo (root@dellr330-build) #3 SMP Wed Jul 27 05:44:53 BST 2022, RO-rootFS, swap_dev 0X6, Normal VGA
srcshelton commented 2 years ago
$ xz --version
xz (XZ Utils) 5.2.5
liblzma 5.2.5
speed47 commented 1 year ago

Some utils were missing from the container image (including xz-utils), I expected this is the problem you had here. If this is the case, it should be fixed with latest master branch (especially commit a2843575be969aaedfb955285c23874aa18cd599)

speed47 commented 1 year ago

Assuming this is fixed, please reopen if needed