[Bug 14041] using modprobe/insmod with compressed modules gives scary kernel warnings

bugzilla at busybox.net bugzilla at busybox.net
Fri Jan 17 09:05:40 UTC 2025


https://bugs.busybox.net/show_bug.cgi?id=14041

--- Comment #2 from christian at kohlschutter.com ---
I just ran into this, too. In Linux 6, the kernel error log I get is the
following:

"Invalid ELF header magic: != ELF" (or: "Invalid ELF header magic: != \x7fELF")

This is due to bb_init_module in busybox/modutils/modutils.c relying on the
kernel to perform in-kernel decompression via finit_module with
MODULE_INIT_COMPRESSED_FILE.

The in-kernel decompression functionality may not always be available
("CONFIG_MODULE_DECOMPRESS=y"), or not configured for the current compression
method (gz vs. xz, etc.).

Asking users to enable CONFIG_MODULE_DECOMPRESS may not be an option for
security reasons. It also doesn't cover all cases since multiple different
compression methods are not supported by the kernel...

When a kernel rightfully responds with "EOPNOTSUPP", busybox keeps trying to
load it as an uncompressed module instead ("/* Loading non-.ko named
uncompressed module? Not likely, but let's try it */").

I suggest that at least errno should be checked for EOPNOTSUPP and reported to
the caller.

Also see this insmod wrapper script that may work instead, proposed in 
2006: https://lists.busybox.net/pipermail/busybox/2006-November/059513.html

Of course, implementing decompression here in busybox would be the right thing.

Notably, Alpine Linux does not enable CONFIG_MODULE_DECOMPRESS but relies on
kmod's implementation instead ("apk add kmod").

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list