Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jul 2008
Modifying "struct module" breaks insmod
I get the error:
insmod: -1 Invalid parameters
Jul 15 12:35:46 xensezer kernel: [ 199.878540] WARNING: at /home/ecsezer/kernels/linux-2.6.24/lib/kobject.c:176 kobject_add()
Jul 15 12:35:46 xensezer kernel: [ 199.878546] Pid: 6033, comm: insmod Not tainted 2.6.24-19-generic #4
Jul 15 12:35:46 xensezer kernel: [ 199.878548]
Jul 15 12:35:46 xensezer kernel: [ 199.878548] Call Trace:
Jul 15 12:35:46 xensezer kernel: [ 199.878556] [kobject_get+0x12/0x20] kobject_get+0x12/0x20
Jul 15 12:35:46 xensezer kernel: [ 199.878563] [kobject_add+0x1ec/0x200] kobject_add+0x1ec/0x200
Jul 15 12:35:46 xensezer kernel: [ 199.878570] [mod_sysfs_setup+0x34/0xe0] mod_sysfs_setup+0x34/0xe0
Jul 15 12:35:46 xensezer kernel: [ 199.878573] [sys_init_module+0x1556/0x1aa0] sys_init_module+0x1556/0x1aa0
Jul 15 12:35:46 xensezer kernel: [ 199.878581] [_atomic_dec_and_lock+0x48/0x70] _atomic_dec_and_lock+0x48/0x70
Jul 15 12:35:46 xensezer kernel: [ 199.878584] [ext3:dput+0xbc/0x340] dput+0xbc/0x140
Jul 15 12:35:46 xensezer kernel: [ 199.878591] [system_call+0x7e/0x83] system_call+0x7e/0x83
Jul 15 12:35:46 xensezer kernel: [ 199.878596]
I compile the LKM before trying to load it. Why is this happening? I appreciate any insight and/or pointers to other sources.
PS. I do get some warning messages about some modules (no name) not agreeing about the size of 'struct module'. But I'm not sure if the two are related. The snippet from /var/log/messages above only happens when I try to install a module. The module loading fails but the kernel continues to run ok.
- Join Date
- Jul 2008
So I had given up on this problem and decided to create my own header file and data structures without changing the original declarations. However, I recently realized that some of the changes I made were not taking effect. So I think I've found the problem.
When I modify and recompile the kernel, all the builtin modules compile with the header files I've modified. But when I install the kernel, the header files in /usr/src/linux-header-* were not updated. Therefore LKM's I compiled later were still using the original header files.
I'm using Ubuntu Hardy and following the instructions in https://help.ubuntu.com/community/Kernel/Compile. I realized that the header files are installed in /usr/src/linux-2.6.24-19-generic and the header files are symbolic links to the real header files that are not modified. I'm not sure if this was intentional or not and I'll post on Ubuntu forums as well. Here is the output from dpkg:
(Reading database ... 142983 files and directories currently installed.) Preparing to replace linux-headers-2.6.24-19-generic 2.6.24-19.34 (using linux-headers-2.6.24-19-generic_2.6.24-19.34_amd64.deb) ... Unpacking replacement linux-headers-2.6.24-19-generic ... Setting up linux-headers-2.6.24-19-generic (2.6.24-19.34) ...
Finally, the Makefile I'm using to compile my LKM is:
obj-m += test.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean