intel-microcode seems to result in an invalid initrd
Bug #1507443 reported by
Alex Lowe
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
intel-microcode (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
The intel-microcode package seems to have caused my initrd to be corrupt, only extracting the microcode bin file into /kernel/
With kernel 4.1 and earlier, this seems not to be an issue, and Ubuntu can still load cryptsetup to decrypt an encrypted root (how I first noticed this). However, as of kernel 4.2 this seems to no longer be the case.
Attached is an initrd created with intel-microcode installed. file detects it as an uncompressed cpio archive (as opposed to a gzip'd one created without intel-microcode installed), and it only extracts a 'kernel' directory.
To post a comment you must log in.
The gzipped CPIO archive at file position 0x2c00 is valid:
$ dd if=/tmp/ initrd. img-4.2. 0-16-generic. bak of=/tmp/ initramfs. bin.gz bs=256 skip=44 bin.gz | cpio -t -i >/dev/null
$ zcat /tmp/initramfs.
176985 blocks
And the first uncompressed CPIO archive at file position 0 is also valid:
$ cat /tmp/initrd. img-4.2. 0-16-generic. bak | cpio -t -i x86/microcode x86/microcode/ GenuineIntel. bin
kernel
kernel/x86
kernel/
kernel/
22 blocks
The padding between the two initramfs is a sequence of zeros, and it is aligned to a block/record size of 1024, which is one of the typical block sizes for CPIO archives (cpio block size only affects padding).
The heuristics initramfs-tools "lsinitramfs" uses to locate the next initramfs are incomplete (it does not skip over the padding at the end of each initramfs) and causes zcat to crash (which is likely a bug in zcat itself):
$ lsinitramfs /tmp/initrd. img-4.2. 0-16-generic. bak img-4.2. 0-16-generic. bak x86/microcode x86/microcode/ GenuineIntel. bin
/tmp/initrd.
kernel
kernel/x86
kernel/
kernel/
*** Error in `zcat': double free or corruption (!prev): 0x00000000021efdb0 ***
I will check if something changed in the early initramfs loaders from kernel 4.1 to 4.2, but this is not likely to be the root cause of the problem.
Can you still reproduce this bug with up-to-date kernels (i.e. please test against 4.1.17 and 4.3.5 or 4.4.1) ?