Busybox modprobe brings error "Invalid ELF header magic: !=ELF"

Jeff Pohlmeyer yetanothergeek at gmail.com
Fri Apr 28 14:19:48 UTC 2023


On Fri, Mar 31, 2023 at 6:20 AM Denys Vlasenko <vda.linux at googlemail.com> wrote:

> Kernel does not auto-detect compressed modules.
> We need to call finit_module() with MODULE_INIT_COMPRESSED_FILE flag
> if module is compressed.
>
> Fixed it in git. Please try it now.

This is not working for me. In the best case, finit_module() tries the
MODULE_INIT_COMPRESSED_FILE flag and returns -1 with errno set to
ENOEXEC (Exec format error). It then tries again with the flag set to
zero and returns the same error. Then it continues on to the
init_module() call, which successfully loads the module.

But in the worst case (which seems to happen randomly), finit_module()
tries the MODULE_INIT_COMPRESSED_FILE flag and immediately receives a
SIGKILL, killing busybox and failing to load the module. (See
attachment for dmesg output.)

This is on Artix Linux with their stock kernel 6.2.11. The modules are
zstd compressed and my busybox has the zstd patch applied, but I don't
think that is causing the problem since the random crashes occur when
the kernel is asked to do the decompression. If the code makes it to
the part where busybox does the decompression, all is well.

If I completely disable the `#ifdef __NR_finit_module` block,
everything works just fine. I wonder how many people actually need
this feature -- maybe there could be a build option to disable it? I
didn't find any usage of MODULE_INIT_COMPRESSED_FILE  in the kmod-30
sources, and there is scant mention of it on google or bing.

 - Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb-modprobe.dmesg
Type: application/octet-stream
Size: 5108 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20230428/8c6a704f/attachment.obj>


More information about the busybox mailing list