x86 image trailing garbage

Paul D newtwen at gmail.com
Mon Sep 30 14:52:07 PDT 2024


https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/openwrt-23.05.5-x86-64-generic-ext4-combined-efi.img.gz

With how the images are compiled, there appears to be a faulty step that adds trailing garbage (some fake certificate).


Hex View  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F
 
00B011B0  00 C0 41 F0 B5 48 21 00  7E 84 07 23 20 66 61 6B  ..A..H!.~..# fak
00B011C0  65 20 63 65 72 74 69 66  69 63 61 74 65 46 57 78  e certificateFWx
00B011D0  30 76 5A EE B8 00 00 00  00 00 00 00 22           0vZ........."


Given that these .img.gz files are made by piping data, the compressor does not have sufficient information to write a suitable header in the gzip describing file length, and the decompression fails with some gzip utilities.


The GZIP RFC spec makes no allowances for trailing data.

So the Makefile portions that directly produce gzip must remove the erroneous pipes that include trailing garbage:

  IMAGE/combined.img.gz := grub-config pc | combined | grub-install | gzip | append-metadata

  IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata



See also https://github.com/openwrt/openwrt/pull/16553




More information about the openwrt-devel mailing list