[SOLVED] When insmodding I get a "function not implemented" message
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When insmodding I get a "function not implemented" message
Hi!
I have built a module to load it on a UML instance running a different kernel from the one I'm running on the host host. I have built the module against the headers for the kernel I'm using on the guest but when I try to insmod the module (on the guest, of course), I get a "function not implemented" message.
Can insmod be a little more verbose about the function that is not implemented? I tried running strace on the insmod but the error comes from init_module so not much more information is available:
I tried to list all symbols defined in the running kernel (/proc/kallsyms) and then trying to find the symbols defined in the module with nm and checking which are missing from kallsyms but there are too many so I think it's a problem with my method to find them... can you tell me another hack for it?
Code:
$ nm r5r.ko | while read a b c; do if [ "$c" == "" ]; then simbolo=$b; else simbolo=$c; fi; lineas=$( grep $simbolo simbolos.txt | wc -l ); if [ $lineas == 0 ]; then echo Symbol $simbolo is not defined; fi; done
Symbol Queue is not defined
Symbol ____versions is not defined
Symbol __mod_algorithm56 is not defined
Symbol __mod_algorithmtype55 is not defined
Symbol __mod_author26 is not defined
Symbol __mod_capacity60 is not defined
Symbol __mod_capacitytype59 is not defined
Symbol __mod_chunkSize54 is not defined
Symbol __mod_chunkSizetype53 is not defined
Symbol __mod_description27 is not defined
Symbol __mod_diskFiles58 is not defined
Symbol __mod_diskFilestype57 is not defined
Symbol __mod_license25 is not defined
Symbol __mod_srcversion54 is not defined
Symbol __mod_vermagic5 is not defined
Symbol __module_depends is not defined
Symbol __param_algorithm is not defined
Symbol __param_arr_diskFiles is not defined
Symbol __param_capacity is not defined
Symbol __param_chunkSize is not defined
Symbol __param_diskFiles is not defined
Symbol __param_str_algorithm is not defined
Symbol __param_str_capacity is not defined
Symbol __param_str_chunkSize is not defined
Symbol __param_str_diskFiles is not defined
Symbol __this_module is not defined
Symbol algor is not defined
Symbol algorithm is not defined
Symbol chunkSize is not defined
Symbol cleanup_module is not defined
Symbol closeOpenFiles is not defined
Symbol diskFiles is not defined
Symbol diskNum is not defined
Symbol loadedChunk is not defined
Symbol majorNumber is not defined
Symbol param_array_ops is not defined
Symbol param_ops_charp is not defined
Symbol param_ops_int is not defined
Symbol r5r_loadChunkFromDisk is not defined
Symbol r5r_ops is not defined
Symbol r5r_request is not defined
Well, well.... very interesting stuff from the module side. I don't know if the kernel I'm playing with was built with module support because I downloaded it from internet.... now, I just checked and lsmod on the UML guest shows this:
Code:
# lsmod
Opening /proc/modules: No such file or directory
And the file modules is not present on the /proc fs, indeed. Does that mean support for modules was not included when building that kernel?
Now, another thing I noticed is that when you build stuff like modules for the kernel, ARCH=um has to be set, right? So I tried building my module with ARCH=um included in the make command and now I get a lot of errors:
Code:
$ LANG=en make
make -C /lib/modules/2.6.38-2-generic/build M=/home/antoranz/proyectos/r5r/module modules ARCH=um
make[1]: Entering directory `/usr/src/linux-headers-2.6.38-2-generic'
CC [M] /home/antoranz/proyectos/r5r/module/r5r.o
In file included from /usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/vm86.h:130,
from /usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/processor.h:10,
from include/linux/prefetch.h:14,
from include/linux/list.h:7,
from include/linux/module.h:9,
from /home/antoranz/proyectos/r5r/module/r5r.c:8:
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h: In function 'user_mode':
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:164: error: 'SEGMENT_RPL_MASK' undeclared (first use in this function)
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:164: error: (Each undeclared identifier is reported only once
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:164: error: for each function it appears in.)
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:164: error: 'USER_RPL' undeclared (first use in this function)
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h: In function 'user_mode_vm':
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:173: error: 'SEGMENT_RPL_MASK' undeclared (first use in this function)
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/ptrace.h:174: error: 'USER_RPL' undeclared (first use in this function)
In file included from /usr/src/linux-headers-2.6.38-2-generic/arch/um/include/asm/thread_info.h:12,
from include/linux/thread_info.h:56,
from /usr/src/linux-headers-2.6.38-2-generic/arch/um/include/asm/current.h:9,
from /usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/processor.h:15,
from include/linux/prefetch.h:14,
from include/linux/list.h:7,
from include/linux/module.h:9,
from /home/antoranz/proyectos/r5r/module/r5r.c:8:
/usr/src/linux-headers-2.6.38-2-generic/arch/um/include/asm/page.h: At top level:
/usr/src/linux-headers-2.6.38-2-generic/arch/um/include/asm/page.h:14: warning: "PAGE_SIZE" redefined
/usr/src/linux-headers-2.6.38-2-generic/arch/x86/include/asm/page_types.h:8: note: this is the location of the previous definition
/usr/src/linux-headers-2.6.38-2-generic/arch/um/include/asm/page.h:22: fatal error: sysdep/vm-flags.h: No such file or directory
compilation terminated.
make[2]: *** [/home/antoranz/proyectos/r5r/module/r5r.o] Error 1
make[1]: *** [_module_/home/antoranz/proyectos/r5r/module] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.38-2-generic'
make: *** [all] Error 2
I think there are more lessons to be learned before I'm able to load my module.
---------- Post added 04-15-11 at 10:12 AM ----------
Keep in mind I'm building the module on the host, not the UML guest.
And the file modules is not present on the /proc fs, indeed. Does that mean support for modules was not included when building that kernel?
I have read, that the option of "support for loadable modules" is enabled by default, on distributions like OpenSuse, which I think is true, since I never faced any such problems before. I did guess that you must have downloaded the kernel from the net, anyway, now instead of wasting further time by "guessing" things, I think it is better to recompile the kernel ensuring that that option is enabled, just to be sure.
Quote:
Keep in mind I'm building the module on the host, not the UML guest.
I can't comment anything on this issue.
P.S. lsmod works fine on Slackware 13.1 (default kernel)
and /proc/modules is also present here.
Last edited by Aquarius_Girl; 04-15-2011 at 08:28 AM.
Well, well. I have already rebuilt the UML kernel by hand (2.6.38.3, by the way) and apparently the one I downloaded off internet didn't have module support built in because in the one I created I do have it.... so after rebuilding my module against the 2.6.38.3 source I was able to load it.... and now the UML kernel is facing an infinite loop after insmodding so I guess I have to start learning how to debug kernel modules. :-)
and now the UML kernel is facing an infinite loop after insmodding so I guess I have to start learning how to debug kernel modules.
You've put some loops in the kernel module? or you re not able to rmmod it? Anyway, new thread for a new question, BTW, the Kernel debugger is called KDB and its links has been included in the sticky in the Kernel section, if you need it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.