Bug 12446-unable to insmod module. unknwon symbol found

Source: Internet
Author: User
Latest working kernel version:2.6.28Earliest failing kernel version:2.6.26Distribution:Hardware Environment:Software Environment:Problem Description:When you use driver dependent on other driver. It should load cleanely, ifother is loaded. But in kernel 2.6.26 onwards its give error, unknown symbolfound.Actually find_symbol able to find symbol but check_version unable to match crc.Because crc is not know to other driver. Steps to reproduce:1) create two device drivers in two separate directories. let say hello and bye 2) Export Symbol from hello module and try to use that in bye module.3) Compile both the driver separately.4) insmod hello.ko3) While insmod(ing) bye.ko, gives error "Unknown Symbol found"
------- Comment #1 from Roland kletzing 02:44:19-------

what about using modprobe instead ? (as this looks in modules.dep to find thedependend modules and load them before) 
------- Comment #2 from sucheta 21:40:43-------

Hi Roland, using modprobe doesn't work. The entries in modules.dep are added.Still it ends up showing the same prints - "no symbol version for " and"Unknown symbol ". And modprobe fails.
------- Comment #3 from Amit Jain 00:20:32-------

Hi Roland,   Thanks a lot for replying. Below I have written details of experiments wedid and our understanding.Problem: insmod failure for externally compiled module :-Experiments:(1) Compiling 2 modules a.ko and b.ko ( dependent on a.ko ) together :- Works(2) Copying Module.symvers from module "a" dir to the module "b" dir, beforecompiling b.ko :- Works.(3) Modprobe after appending following lines in /lib/modules/modules.dep     /lib/modules/2.6.27.7-smp/kernel/drivers/net/a.ko    /lib/modules/2.6.27.7-smp/kernel/drivers/net/b.ko:/lib/modules/2.6.27.7-smp/kernel/drivers/net/a.ko   :- Fails(4) After compiling b.ko, just modifying b.mod.c file to include the undefinedsymbol in its version table doesn't work (didn't expect to work ).(5) export_objs (doesn't work):    In Makefile of a.ko:       export_objs := a.ko / export-objs := a.ko / exportobjs := a.ko.(6) Adding "#define EXPORT_SYMTAB" in a.c file (doesn't work).From above experiments, we found that In .mod.c file it maintains __versionsarray, which contains export symbol name and its crc.We see symbols of modules which are compiled with kernel. No symbols ofexternally compiled modules.The call trace is load_module -> simplify_symbols -> resolve_symbol -> find_symbol and check_version ( if find_symbol succeeds ).check_version behavior comparison in 2.6.26 and earlier version kernels :-In earlier versions of kernel also, symbol couldn't be found in its versiontable. Still, check_version used to return 1 (success) and the dependent module could be insmod(ed) successfully.However, in kernel 2.6.26 onwards, behavior has changed.  check_version on notfinding the reqd. symbol in its version table returns 0 (fail) and  thedependent external module can't be inserted anymore.Waiting eagerly for your reply. Thanks in advance.
------- Comment #4 from Amit Jain 21:04:34-------

Any updates ?
------- Comment #5 from Alan 2009-03-19 10:19:16-------

No but this is not a support facility, just a bug tracker and as a problem onlyyou've reported and nobody else has duplicated its a very very low priority,especially as its only out of tree code seeing it
------- Comment #6 from Amit Jain 21:04:12-------

It should not be very very low priotity, Its easy to reproduce. Its should be blocker bug, because anybody how will try to compile moduledependent on other module, will fail.Strange, Why didn't nobody reply on it.I am really stuck, because of this problem.
------- Comment #7 from tejun Heo 21:48:40-------

cc'ing Rusty Russell.
------- Comment #8 from Roland kletzing 12:11:23-------

hello amit, i think alan is right. this seems a very specific, personal problem. anyway, if you think it`s a general kernel problem, please post an as simple aspossible repro-case (i.e. some sourcecode) for your problem, so chances willraise that someone will look at your problem. i`d recommend bringing this up on kernel related mailing lists
------- Comment #9 from Rusty Russell 23:00:51-------

This is true; a5dd69707424a35d2d2cc094e870f595ad61e916 changed this.The argument is that modversions is supposed to version symbols used in amodule, and thisdoesn't really work for out-of-tree modules (unless you copy Module.symversacross, as doneabove).   Otherwise module B doesn't know the version of symbol A; we changedsuch a missingversion to fail; the user *did* want us to check versions.Currently you have to modprobe --force-modversion to load such a module.I think the new behavior is correct.
------- Comment #10 from qihua Dai 05:28:02-------

I also met the same problem on kernel 2.6.28.10."modprobe --force-modversion" does work for me, it will report "invalid moduleformat"Besides the solution of copy Module.symvers across, below solution canworkaround it:In the makefile of "b", define KBUILD_EXTRA_SYMBOLS which points toModule.symvers in "a" Dir so that "b" will find Module.symvers of "a"e.g.KBUILD_EXTRA_SYMBOLS=/mod_a/Module.symversDuring building "b", the search path of Module.symvers will be. Please correctme if my understanding is incorrect.1, kernel source path, e.g. /usr/src/kernels/linux-2.6.28.10 2, the value of $(M) defined in makefile, which is the same as the value ofKBUILD_EXTMOD3, the value of KBUILD_EXTRA_SYMBOLSI think it's a generic kernel problem. It's better to fix it. Below attached asimple case which is from below link:http://topic.csdn.net/u/20081009/11/6fb7295c-0d30-4d4f-b390-af4413aa7f7e.html?seed=1582387931=============C/C++ code// Module A (mod_a.c)#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>static int func1(void){       printk("In Func: %s.../n",__func__);       return 0;}// Export symbol func1EXPORT_SYMBOL(func1);static int __init hello_init(void){       printk("Module 1,Init!/n");       return 0;}static void __exit hello_exit(void){       printk("Module 1,Exit!/n");}module_init(hello_init);module_exit(hello_exit);=============C/C++ code// Module B (mod_b.c)#include<linux/init.h>#include<linux/kernel.h>#include<linux/module.h>static int func2(void){       extern int func1(void);       func1();       printk("In Func: %s.../n",__func__);       return 0;}static int __init hello_init(void){       printk("Module 2,Init!/n");       func2();       return 0;}static void __exit hello_exit(void){       printk("Module 2,Exit!/n");}module_init(hello_init);module_exit(hello_exit);=============Makefile for Module A BatchFile codeobj-m += mod1.omod1-y := mod_a.oKVERSION = $(shell uname -r)all:     make -C /lib/modules/$(KVERSION)/build M=$(PWD) modulesclean:    make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean    rm -f *.o *.ko *.cmd=============Makefile for Module B BatchFile codeobj-m += mod2.omod2-y := mod_b.oKVERSION = $(shell uname -r)all:     make -C /lib/modules/$(KVERSION)/build M=$(PWD) modulesclean:    make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean    rm -f *.o *.ko *.cmd
------- Comment #11 from qihua Dai 05:31:40-------

A typo, it should be""modprobe --force-modversion" does NOT work for me, it will report "invalidmoduleformat""
------- Comment #12 from Rusty Russell 06:54:15-------

You can't modprobe --force if  CONFIG_MODULE_FORCE_LOAD isn't set.  That wasadded in 2.6.26, and is off by default.Hope that clarifies,Rusty.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.