-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Labels
Description
Describe the bug
I was browsing Nix projects when I found this one and thought "that's cool, should be useful to inspect initrds, but unfortunately, that currently does not really work very much.
The below command tries to extract a zstd-compressed NixOS initramfs with prepended Intel CPU microcode, but:
7zfails to extract the main CPIO archive, butunblobstill exits with 0/success.- The prepended microcode CPIO archive is reported to be found, but then missing in the output.
- There are
unknownchunks that are really just zero-padding.
To Reproduce
nix run github:onekey-sec/unblob/23.5.31 -- $( nix build --no-link --print-out-paths github:srid/nixos-config/1a6879bbd1c0f87f67533a7b91bc438e042b3bf6#nixosConfigurations.actual.config.system.build.initialRamdisk )/initrd
Command output
2023-08-10 23:58.54 [info ] Start processing file file=/nix/store/msmx1ylsyhxk6hx3p4nz39vqi2gkzn3j-initrd-linux-6.1.43/initrd pid=3806009
2023-08-10 23:58.54 [warning ] Found unknown Chunks chunks=[0x6f1200-0x6f1800] pid=3806014
2023-08-10 23:58.54 [info ] Extracting unknown chunk chunk=0x6f1200-0x6f1800 path=initrd_extract/7279104-7280640.unknown pid=3806014
2023-08-10 23:58.54 [info ] Extracting valid chunk chunk=0x6f1800-0x12284cb path=initrd_extract/7280640-19039435.zstd pid=3806014
2023-08-10 23:58.54 [info ] Extracting valid chunk chunk=0x0-0x6f1200 path=initrd_extract/0-7279104.cpio_portable_ascii pid=3806014
2023-08-10 23:58.54 [warning ] Found unknown Chunks chunks=[0x19b3000-0x19b4000] pid=3806016
2023-08-10 23:58.54 [info ] Extracting unknown chunk chunk=0x19b3000-0x19b4000 path=initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/26947584-26951680.unknown pid=3806016
2023-08-10 23:58.54 [info ] Extracting valid chunk chunk=0x0-0x19b3000 path=initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/0-26947584.cpio_portable_ascii pid=3806016
2023-08-10 23:58.54 [error ] Extract command failed command=7z x -y /tmp/initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/0-26947584.cpio_portable_ascii -o/tmp/initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/0-26947584.cpio_portable_ascii_extract exit_code=0x2 pid=3806016 severity=<Severity.WARNING: 'WARNING'> stderr=
ERRORS:
There are data after the end of archive
ERROR: There are some data after the end of the payload data : 0-26947584
stdout=
7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=C,Utf16=off,HugeFiles=on,64 bits,16 CPUs x64)
Scanning the drive for archives:
1 file, 26947584 bytes (26 MiB)
Extracting archive: /tmp/initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/0-26947584.cpio_portable_ascii
--
Path = /tmp/initrd_extract/7280640-19039435.zstd_extract/zstd.uncompressed_extract/0-26947584.cpio_portable_ascii
Type = xz
ERRORS:
There are data after the end of archive
Offset = 35432
Physical Size = 5228
Tail Size = 26906924
Method = LZMA2:21
Streams = 1
Blocks = 1
Sub items Errors: 1
Archives with Errors: 1
Open Errors: 1
Sub items Errors: 1
tree -s ./initrd_extract
[ 4] initrd_extract
├── [ 1536] 7279104-7280640.unknown
└── [ 4] 7280640-19039435.zstd_extract
├── [ 26951680] zstd.uncompressed
└── [ 5] zstd.uncompressed_extract
├── [ 26947584] 0-26947584.cpio_portable_ascii
├── [ 3] 0-26947584.cpio_portable_ascii_extract
│ └── [ 27568] 0-26947584
└── [ 4096] 26947584-26951680.unknown
Expected behavior
7znot to fail / something else (likecpio) to extract the archive.unblobto exit non-zero upon sub-command failure.- The microcode in the output tree.
unknownblocks that are entirely zero to be calledzero-paddingor something like that.
Environment information
- Nix 2.13.3 on NixOS 23.05
- (all other versions are pinned via nix flakes, see the above commands)