Missing __versions section on .ko
Any idea what causes __versions section to get added in *.ko module. A simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. Other module just doesn't get loaded giving error " Invalid module ". When I compared both modules with objdump -h I found __versions section was missing from second module and that can be the reason its not getting loaded. How can I add this section to other .ko ? What causes __versions to get added in ko ? Thanks, Pritam Bankar
On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
Any idea what causes __versions section to get added in *.ko module. A simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. Other module just doesn't get loaded giving error " Invalid module ". When I compared both modules with objdump -h I found __versions section was missing from second module and that can be the reason its not getting loaded. How can I add this section to other .ko ? What causes __versions to get added in ko ?
I have compiled both modules with modpost and Module.symvers. Thanks, Pritam Bankar -- Pritam Bankar
Hi, 'Invalid module' is typically thrown when you don't compile your module against the kernel you are linking into. I think __versions section is added by vermagic.o as part of build process. Please refer http://lwn.net/images/pdf/LDD3/ch02.pdf, Version dependency section for more details. Thanks, Ramesh On Tue, Sep 18, 2012 at 7:10 AM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
Any idea what causes __versions section to get added in *.ko module. A simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. Other module just doesn't get loaded giving error " Invalid module ". When I compared both modules with objdump -h I found __versions section was missing from second module and that can be the reason its not getting loaded. How can I add this section to other .ko ? What causes __versions to get added in ko ?
I have compiled both modules with modpost and Module.symvers.
Thanks, Pritam Bankar
--
Pritam Bankar
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Ramesh thanks for great pdf. From whatever I understood after reading I fired command modinfo on my module and it gave output , vermagic: 3.2.0-23-generic-pae SMP mod_unload modversions 686 greping out vermagic. So I believe vermagic is behaving correctly. What is 686 in output ? Any other reason for missing __versions section ? On Wed, Sep 19, 2012 at 6:24 AM, Ramesh.P <rameshpa@gmail.com> wrote:
Hi,
'Invalid module' is typically thrown when you don't compile your module against the kernel you are linking into. I think __versions section is added by vermagic.o as part of build process. Please refer http://lwn.net/images/pdf/LDD3/ch02.pdf, Version dependency section for more details.
Thanks, Ramesh
On Tue, Sep 18, 2012 at 7:10 AM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
Any idea what causes __versions section to get added in *.ko module. A simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. Other module just doesn't get loaded giving error " Invalid module ". When I compared both modules with objdump -h I found __versions section was missing from second module and that can be the reason its not getting loaded. How can I add this section to other .ko ? What causes __versions to get added in ko ?
I have compiled both modules with modpost and Module.symvers.
Thanks, Pritam Bankar
--
Pritam Bankar
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Pritam Bankar
Hi, Please see my comments inline. On Fri, Sep 21, 2012 at 2:39 PM, Pritam Bankar <pritambankar1988@gmail.com> wrote: > Hi Ramesh thanks for great pdf. From whatever I understood after > reading I fired command modinfo on my module and it gave output , > > vermagic: 3.2.0-23-generic-pae SMP mod_unload modversions 686 > > greping out vermagic. So I believe vermagic is behaving correctly. > What is 686 in output ? It represents the arch. the module is built for. In this case, it is 686. > Any other reason for missing __versions section ? The other reason for invalid format is mismatch in arch. like mips vs 686. It looks like you are trying to run this module on a 386 machine. Can you confirm you have recompiled the module on the kernel you are trying to link. Thanks, Ramesh > > On Wed, Sep 19, 2012 at 6:24 AM, Ramesh.P <rameshpa@gmail.com> wrote: >> Hi, >> >> 'Invalid module' is typically thrown when you don't compile your >> module against the kernel you are linking into. I think __versions >> section is added by vermagic.o as part of build process. Please refer >> http://lwn.net/images/pdf/LDD3/ch02.pdf, Version dependency section >> for more details. >> >> Thanks, >> Ramesh >> >> On Tue, Sep 18, 2012 at 7:10 AM, Pritam Bankar >> <pritambankar1988@gmail.com> wrote: >>> On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar >>> <pritambankar1988@gmail.com> wrote: >>>> Any idea what causes __versions section to get added in *.ko module. A >>>> simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. >>>> Other module just doesn't get loaded giving error " Invalid module ". >>>> When I compared both modules with objdump -h I found __versions >>>> section was missing from second module and that can be the reason its >>>> not getting loaded. How can I add this section to other .ko ? What >>>> causes __versions to get added in ko ? >>> >>> >>> I have compiled both modules with modpost and Module.symvers. >>> >>> >>> Thanks, >>> Pritam Bankar >>> >>> -- >>> >>> Pritam Bankar >>> >>> _______________________________________________ >>> Kernelnewbies mailing list >>> Kernelnewbies@kernelnewbies.org >>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > -- > > Pritam Bankar
On Mon, Sep 24, 2012 at 9:41 PM, Ramesh.P <rameshpa@gmail.com> wrote: > Hi, > > Please see my comments inline. > > On Fri, Sep 21, 2012 at 2:39 PM, Pritam Bankar > <pritambankar1988@gmail.com> wrote: >> Hi Ramesh thanks for great pdf. From whatever I understood after >> reading I fired command modinfo on my module and it gave output , >> >> vermagic: 3.2.0-23-generic-pae SMP mod_unload modversions 686 >> >> greping out vermagic. So I believe vermagic is behaving correctly. >> What is 686 in output ? > It represents the arch. the module is built for. In this case, it is 686. > >> Any other reason for missing __versions section ? > The other reason for invalid format is mismatch in arch. like mips vs > 686. It looks like you are trying to run this module on a 386 machine. > Can you confirm you have recompiled the module on the kernel you are > trying to link. > Yes I am running this module on i386 machine and I am linking compiled module on same kernel 3.2.0-23-generic-pae My module works perfectly on x86_64 machine which has same kernel 3.2.0-23-generic but without -pae >> >> On Wed, Sep 19, 2012 at 6:24 AM, Ramesh.P <rameshpa@gmail.com> wrote: >>> Hi, >>> >>> 'Invalid module' is typically thrown when you don't compile your >>> module against the kernel you are linking into. I think __versions >>> section is added by vermagic.o as part of build process. Please refer >>> http://lwn.net/images/pdf/LDD3/ch02.pdf, Version dependency section >>> for more details. >>> >>> Thanks, >>> Ramesh >>> >>> On Tue, Sep 18, 2012 at 7:10 AM, Pritam Bankar >>> <pritambankar1988@gmail.com> wrote: >>>> On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar >>>> <pritambankar1988@gmail.com> wrote: >>>>> Any idea what causes __versions section to get added in *.ko module. A >>>>> simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. >>>>> Other module just doesn't get loaded giving error " Invalid module ". >>>>> When I compared both modules with objdump -h I found __versions >>>>> section was missing from second module and that can be the reason its >>>>> not getting loaded. How can I add this section to other .ko ? What >>>>> causes __versions to get added in ko ? >>>> >>>> >>>> I have compiled both modules with modpost and Module.symvers. >>>> >>>> >>>> Thanks, >>>> Pritam Bankar >>>> >>>> -- >>>> >>>> Pritam Bankar >>>> >>>> _______________________________________________ >>>> Kernelnewbies mailing list >>>> Kernelnewbies@kernelnewbies.org >>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> >> >> >> -- >> >> Pritam Bankar -- Pritam Bankar
On Tue, Sep 18, 2012 at 10:10 PM, Pritam Bankar <pritambankar1988@gmail.com>wrote:
On Tue, Sep 18, 2012 at 7:27 PM, Pritam Bankar <pritambankar1988@gmail.com> wrote:
Any idea what causes __versions section to get added in *.ko module. A simple hello.ko on ubuntu 12.04 i386 machine gets loaded successfully. Other module just doesn't get loaded giving error " Invalid module ". When I compared both modules with objdump -h I found __versions section was missing from second module and that can be the reason its not getting loaded. How can I add this section to other .ko ? What causes __versions to get added in ko ?
I have compiled both modules with modpost and Module.symvers.
The real reason why kernel prevent the module outside to insmod is ABI, Application binary interface, which is referred in http://en.wikipedia.org/wiki/Application_binary_interface. If you do want to bypass it without rebuilding kernel ,you can do like this. http://hi.baidu.com/wzt85/item/dcea082c90c9ed0942634ad2 :)
participants (3)
-
lucien xin -
Pritam Bankar -
Ramesh.P