insmod: invalid module format with 2.6.27 kernel

Dallas Clement dallas at clementkin.com
Mon Apr 13 06:03:27 UTC 2009


Unfortunately, I can't easily capture all of the strace output since I am
executing from the initramfs and have no writable disks.  Here are some
excerpts I hand copied from the console output  (this is for insmod
scsi_mod):

[skipping some stuff]
uname({sys="Linux", node="(none)", ...}) = 0
open("/lib/modules/2.6.26/scsi_mod.ko", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0755, st_size=120652, ...}) = 0
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\3\0\1\0\0\0\0\0\0\0\0\0\0\01"...,
120832) = 120652
read(3, ""..., 180) = 0
close(3) = 0
init_module(0x80e6308, 120652, ""SCSI Subsystem initialized) = 0
exit_group(0)  = ?

Can you see anything troubling here?  It'll take me quite a bit more effort
to obtain the dump you recommended.  I don't have a tmpfs or shell hooked up
yet since I'm executing this from initramfs.


2009/4/12 Denys Vlasenko <vda.linux at googlemail.com>

> On Sunday 12 April 2009 22:04, Dallas Clement wrote:
> > Hello All,
> >
> > I have been using busybox version 1.13.3 just fine with the linux kernel
> > version 2.6.21.1.  I recently upgraded my kernel to 2.6.27 and am now
> > getting an error when I try to insert a kernel module.  For example:
>
> Can you provide strace log of "insmod /path/to/ext2.ko"?
>
> > ext2:  no symbol version for struct_module
> >
> > insmod: cannot insert '/lib/modules/2.6.27/ext2.ko': invalid module
> format
>
> The message comes from modutils/insmod.c:
>
> int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
> int insmod_main(int argc UNUSED_PARAM, char **argv)
> {
> ...
>        rc = bb_init_module(filename, parse_cmdline_module_options(argv));
>        if (rc)
>                bb_error_msg("cannot insert '%s': %s", filename,
> moderror(rc));
>
> "invalid module format" corresponds to errno == ENOEXEC.
>
>
> And bb_init_module() is doing this:
>
> int FAST_FUNC bb_init_module(const char *filename, const char *options)
> {
>        size_t len = MAXINT(ssize_t);
>        char *image;
>        int rc = ENOENT;
> #if ENABLE_FEATURE_2_4_MODULES
>        if (get_linux_version_code() < KERNEL_VERSION(2,6,0))
>                return bb_init_module_24(filename, options);
> #endif
>        /* Use the 2.6 way */
>        image = xmalloc_open_zipped_read_close(filename, &len);
>        if (image) {
>                if (init_module(image, len, options) != 0)
>                        rc = errno;
>                else
>                        rc = 0;
>                free(image);
>        }
>        return rc;
> }
>
> As far as I see, it is rather straightforward and correct.
> you may add this line
>
> xwrite(xopen3("/tmp/dump", O_WRONLY, 0644), image, len);
>
> directly after "image = xmalloc_open_zipped_read_close(...)"
> to obtain the dump of read module and check that it is not
> damaged by automatic compression detection:
> /tmp/dump file should be exactly identical to your ext2.ko file.
>
> --
> vda
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090413/5c57d5d3/attachment.htm>


More information about the busybox mailing list