While I was digging into a dkms bug, I've noticed that kmod does not fallback to the normal init_module() code path when the in-kernel decompression fails. As I looked closer, I realised that the current module compression detection relies on kmod being build with zstd, xz, zlib ... Even in the case where we rely on the kernel module itself to decompress - aka we don't use the external libraries all together. By building kmod without zstd and friends, we shave some space off the initrd which helps with boot time. Majority of this series handles the latter and fixes a few related bugs along the way. The last commits is somewhat questionable commit and addresses the former issue. Happy to hear your feedback, Emil --- Emil Velikov (13): libkmod: use a dup()'d fd for zlib libkmod: keep gzFile gzf local to load_zlib() libkmod: remove kmod_file::{zstd,xz}_used flags libkmod: clear file->memory if map fails libkmod: nuke struct file_ops libkmod: propagate {zstd,xz,zlib}_load errors libkmod: move kmod_file_load_contents as applicable libkmod: always detect the module compression libkmod: swap alloca usage for a few assert_cc libkmod: tidy-up kmod_file_open() libkmod: move load_reg() further up libkmod: keep KMOD_FILE_COMPRESSION_NONE/load_reg in comp_types libkmod: always fallback to do_init_module() libkmod/libkmod-file.c | 206 ++++++++++++++++++--------------------------- libkmod/libkmod-internal.h | 2 +- libkmod/libkmod-module.c | 8 +- 3 files changed, 90 insertions(+), 126 deletions(-) --- base-commit: b29704cd448aaa455dba4e656fc0f0d3c686df3f change-id: 20240212-decompression-fixes-56371eeb707d Best regards, -- Emil Velikov <emil.l.velikov@xxxxxxxxx>