linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Dumping the checksums in a module
@ 2007-06-19 11:59 John Sigler
  2007-06-19 13:18 ` Arjan van de Ven
  0 siblings, 1 reply; 10+ messages in thread
From: John Sigler @ 2007-06-19 11:59 UTC (permalink / raw)
  To: linux-kernel

Hello everyone,

As far as I understand (which is not very far), if I define
CONFIG_MODVERSIONS, then checksums for various functions (all exported
functions?) and various structures (which ones?) will be included inside
the kernel image, and written to Module.symvers. When an out-of-tree
module is built, it will *also* include these checksums.

How do I list ALL the checksums within a module?

$ /sbin/modinfo -V
module-init-tools version 3.2.2

$ uname -a
Linux venus 2.6.18.6 #1 PREEMPT Thu Feb 8 18:04:49 CET 2007 i686
pentium4 i386 GNU/Linux

$ /sbin/modinfo test.ko
filename:       test.ko
vermagic:       2.6.20.7-rt8 preempt mod_unload PENTIUMIII REGPARM
depends:
parm:           pConfig_file:charp
parm:           allocator_himem:An integer (int)
parm:           EnableIdleMode:An integer (int)
parm:           Board_ID:An integer (int)
parm:           Diagnostic:An integer (int)

$ hexdump -C test.ko | grep -A2 struct_
000752e0  17 98 07 0e 73 74 72 75  63 74 5f 6d 6f 64 75 6c
|....struct_modul|
000752f0  65 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
|e...............|
00075300  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
|................|

I think this means that, in this module, the checksum for symbol
struct_module is 0x1798070e, right?

Is there a simpler way to list all the checksums?

Regards.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-06-19 11:59 Dumping the checksums in a module John Sigler
@ 2007-06-19 13:18 ` Arjan van de Ven
  2007-06-19 14:40   ` John Sigler
  0 siblings, 1 reply; 10+ messages in thread
From: Arjan van de Ven @ 2007-06-19 13:18 UTC (permalink / raw)
  To: John Sigler; +Cc: linux-kernel

On Tue, 2007-06-19 at 13:59 +0200, John Sigler wrote:
> Hello everyone,
> 
> As far as I understand (which is not very far), if I define
> CONFIG_MODVERSIONS,


just don't enable modversions.. it doesn't provide you any real safety
at all..... and it makes your build a LOT slower.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-06-19 13:18 ` Arjan van de Ven
@ 2007-06-19 14:40   ` John Sigler
  0 siblings, 0 replies; 10+ messages in thread
From: John Sigler @ 2007-06-19 14:40 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

Arjan van de Ven wrote:

> On Tue, 2007-06-19 at 13:59 +0200, John Sigler wrote:
>
>> As far as I understand (which is not very far), if I define
>> CONFIG_MODVERSIONS,
> 
> just don't enable modversions.. it doesn't provide you any real safety
> at all..... and it makes your build a LOT slower.

I'm confused. What is the consensus on MODVERSIONS around here?
How many people share your views?

I was under the impression MODVERSIONS was a good thing(TM).

If I don't enable CONFIG_MODVERSIONS, then I'll have to recompile my 
out-of-tree modules every time I upgrade the kernel, even if I'm just 
upgrading from 2.6.20.7 to 2.6.20.8, unless I force the insertion.

I also have a few binary modules. If I force the insertion, I won't know 
they have become binary incompatible until they blow up later, or, 
worse, lead to silent corruption.

Please correct any and all misconceptions.

Regards.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-22 19:53     ` Jan Engelhardt
@ 2007-05-23 15:18       ` John Sigler
  0 siblings, 0 replies; 10+ messages in thread
From: John Sigler @ 2007-05-23 15:18 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel

Jan Engelhardt wrote:
> On May 22 2007 10:13, John Sigler wrote:
>>>> How do I list the checksums within a module?
>>>> Is there a simpler way to list all the checksums?
>>> 22:25 ichi:~ > modinfo aes
>>> srcversion:     8CB82B3A254D5A950FD0D14
>>>
>>> I think this one checksum is computed out of all functions that
>>> the module uses.
>> You've enabled MODULE_SRCVERSION_ALL which adds a checksum computed from the
>> source files used to build a given module. What I want is to list ALL the
>> checksums of the symbols included inside a given module.
>>
>> e.g. for the kernel:
> 
> for i in `nm 
> /lib/modules/2.6.18.8-ccj45-default/kernel/block/as-iosched.ko |
> grep " U " | cut -b 20-`; do
>     grep '\b'"$i"'\b' Module.symvers;
> done;
> 
> (for 32-bit, use `cut -b 12-`)

I think you didn't understand my request.

I have a *binary* kernel module that was compiled with 
CONFIG_MODVERSIONS enabled.

Thus, that binary module includes 32-bit (?) checksums for several 
kernel functions AND kernel structures.

cf. my original post:

$ hexdump -C test.ko | grep -A2 struct_
000752e0  17 98 07 0e 73 74 72 75  63 74 5f 6d 6f 64 75 6c 
|....struct_modul|
000752f0  65 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|e...............|
00075300  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|

For example, the checksum for "struct_module" seems to be 0x1798070e.

Is there a tool (from linux-module-init-tools?) to list all the 
checksums included in a binary module.

Regards.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-22  8:13   ` John Sigler
@ 2007-05-22 19:53     ` Jan Engelhardt
  2007-05-23 15:18       ` John Sigler
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2007-05-22 19:53 UTC (permalink / raw)
  To: John Sigler; +Cc: linux-kernel


On May 22 2007 10:13, John Sigler wrote:
>> > How do I list the checksums within a module?
>> > Is there a simpler way to list all the checksums?
>> 
>> 22:25 ichi:~ > modinfo aes
>> srcversion:     8CB82B3A254D5A950FD0D14
>> 
>> I think this one checksum is computed out of all functions that
>> the module uses.
>
> You've enabled MODULE_SRCVERSION_ALL which adds a checksum computed from the
> source files used to build a given module. What I want is to list ALL the
> checksums of the symbols included inside a given module.
>
> e.g. for the kernel:

for i in `nm 
/lib/modules/2.6.18.8-ccj45-default/kernel/block/as-iosched.ko |
grep " U " | cut -b 20-`; do
    grep '\b'"$i"'\b' Module.symvers;
done;

(for 32-bit, use `cut -b 12-`)


	Jan
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-18 20:46   ` Sam Ravnborg
@ 2007-05-22  8:19     ` John Sigler
  0 siblings, 0 replies; 10+ messages in thread
From: John Sigler @ 2007-05-22  8:19 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel

Sam Ravnborg wrote:
> On Fri, May 18, 2007 at 10:27:06PM +0200, Jan Engelhardt wrote:
>> On May 18 2007 17:02, John Sigler wrote:
>>> I'm getting "disagrees about version of symbol struct_module" messages,
>>> and I'm trying to understand why.
>>>
>>> As far as I understand (which is not very far), if I define
>>> CONFIG_MODVERSIONS, then checksums for various functions (all exported
>>> functions?) and various structures (which ones?) will be included inside
>>> the kernel image, and written to Module.symvers. When an out-of-tree
>>> module is built, it will also include these checksums.
>>>
>>> How do I list the checksums within a module?
>>>
>>> Is there a simpler way to list all the checksums?
>> 22:25 ichi:~ > modinfo aes
>> srcversion:     8CB82B3A254D5A950FD0D14
>>
>> I think this one checksum is computed out of all functions that
>> the module uses.
>
> It is computed based on all files used for the module.
> Check help for "Loadable module support | Source Checksum for all modules"

How do I list *all* the checksums inside a given module?

For example, I want to know the checksum for "struct_module" in test.ko

$ grep struct_module Module.symvers
0x71d1e11f      struct_module   vmlinux EXPORT_SYMBOL

That's for the kernel.

$(MAGIC_COMMAND_TO_DUMP_CHECKSUMS) test.ko | grep struct_module
=> ...

Regards.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-18 20:27 ` Jan Engelhardt
  2007-05-18 20:46   ` Sam Ravnborg
@ 2007-05-22  8:13   ` John Sigler
  2007-05-22 19:53     ` Jan Engelhardt
  1 sibling, 1 reply; 10+ messages in thread
From: John Sigler @ 2007-05-22  8:13 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel

Jan Engelhardt wrote:

> On May 18 2007 17:02, John Sigler wrote:
>> I'm getting "disagrees about version of symbol struct_module" messages,
>> and I'm trying to understand why.
>>
>> As far as I understand (which is not very far), if I define
>> CONFIG_MODVERSIONS, then checksums for various functions (all exported
>> functions?) and various structures (which ones?) will be included inside
>> the kernel image, and written to Module.symvers. When an out-of-tree
>> module is built, it will also include these checksums.
>>
>> How do I list the checksums within a module?
>>
>> Is there a simpler way to list all the checksums?
> 
> 22:25 ichi:~ > modinfo aes
> srcversion:     8CB82B3A254D5A950FD0D14
> 
> I think this one checksum is computed out of all functions that
> the module uses.

You've enabled MODULE_SRCVERSION_ALL which adds a checksum computed from 
the source files used to build a given module. What I want is to list 
ALL the checksums of the symbols included inside a given module.

e.g. for the kernel:

$ head Module.symvers
0x4da3749b      firmware_unregister     vmlinux EXPORT_SYMBOL_GPL
0xbf9d1364      generic_file_splice_write       vmlinux EXPORT_SYMBOL
0x436417ac      set_anon_super  vmlinux EXPORT_SYMBOL
0x894bc434      kmem_cache_alloc        vmlinux EXPORT_SYMBOL
0x1120b731      request_firmware        vmlinux EXPORT_SYMBOL
0x0a2487e0      unblock_all_signals     vmlinux EXPORT_SYMBOL
0x07d50a24      csum_partial    vmlinux EXPORT_SYMBOL
0xcd6c78f9      __generic_unplug_device vmlinux EXPORT_SYMBOL
0x59ab4080      cap_bset        vmlinux EXPORT_SYMBOL
0xee413334      softirq_preemption      vmlinux EXPORT_SYMBOL
[...]


config MODVERSIONS
bool "Module versioning support"
depends on MODULES
help
   Usually, you have to use modules compiled with your kernel.
   Saying Y here makes it sometimes possible to use modules
   compiled for different kernels, by adding enough information
   to the modules to (hopefully) spot any changes which would
   make them incompatible with the kernel you are running.  If
   unsure, say N.

config MODULE_SRCVERSION_ALL
bool "Source checksum for all modules"
depends on MODULES
help
   Modules which contain a MODULE_VERSION get an extra "srcversion"
   field inserted into their modinfo section, which contains a
   sum of the source files which made it.  This helps maintainers
   see exactly which source was used to build a module (since
   others sometimes change the module source without updating
   the version).  With this option, such a "srcversion" field
   will be created for all modules.  If unsure, say N.

Regards.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-18 20:27 ` Jan Engelhardt
@ 2007-05-18 20:46   ` Sam Ravnborg
  2007-05-22  8:19     ` John Sigler
  2007-05-22  8:13   ` John Sigler
  1 sibling, 1 reply; 10+ messages in thread
From: Sam Ravnborg @ 2007-05-18 20:46 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: John Sigler, linux-kernel

On Fri, May 18, 2007 at 10:27:06PM +0200, Jan Engelhardt wrote:
> 
> On May 18 2007 17:02, John Sigler wrote:
> >
> > I'm getting "disagrees about version of symbol struct_module" messages,
> > and I'm trying to understand why.
> >
> > As far as I understand (which is not very far), if I define
> > CONFIG_MODVERSIONS, then checksums for various functions (all exported
> > functions?) and various structures (which ones?) will be included inside
> > the kernel image, and written to Module.symvers. When an out-of-tree
> > module is built, it will also include these checksums.
> >
> > How do I list the checksums within a module?
> >
> > Is there a simpler way to list all the checksums?
> 
> 22:25 ichi:~ > modinfo aes
> srcversion:     8CB82B3A254D5A950FD0D14
> 
> I think this one checksum is computed out of all functions that
> the module uses.
It is computed based on all files used for the module.
Check help for "Loadable module support | Source Checksum for all modules"

	Sam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Dumping the checksums in a module
  2007-05-18 15:02 John Sigler
@ 2007-05-18 20:27 ` Jan Engelhardt
  2007-05-18 20:46   ` Sam Ravnborg
  2007-05-22  8:13   ` John Sigler
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Engelhardt @ 2007-05-18 20:27 UTC (permalink / raw)
  To: John Sigler; +Cc: linux-kernel


On May 18 2007 17:02, John Sigler wrote:
>
> I'm getting "disagrees about version of symbol struct_module" messages,
> and I'm trying to understand why.
>
> As far as I understand (which is not very far), if I define
> CONFIG_MODVERSIONS, then checksums for various functions (all exported
> functions?) and various structures (which ones?) will be included inside
> the kernel image, and written to Module.symvers. When an out-of-tree
> module is built, it will also include these checksums.
>
> How do I list the checksums within a module?
>
> Is there a simpler way to list all the checksums?

22:25 ichi:~ > modinfo aes
srcversion:     8CB82B3A254D5A950FD0D14

I think this one checksum is computed out of all functions that
the module uses.


	Jan
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Dumping the checksums in a module
@ 2007-05-18 15:02 John Sigler
  2007-05-18 20:27 ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: John Sigler @ 2007-05-18 15:02 UTC (permalink / raw)
  To: linux-kernel

Hello everyone,

I'm getting "disagrees about version of symbol struct_module" messages, 
and I'm trying to understand why.

As far as I understand (which is not very far), if I define 
CONFIG_MODVERSIONS, then checksums for various functions (all exported 
functions?) and various structures (which ones?) will be included inside 
the kernel image, and written to Module.symvers. When an out-of-tree 
module is built, it will also include these checksums.

How do I list the checksums within a module?

$ /sbin/modinfo -V
module-init-tools version 3.2.2

$ uname -a
Linux venus 2.6.18.6 #1 PREEMPT Thu Feb 8 18:04:49 CET 2007 i686 
pentium4 i386 GNU/Linux

$ /sbin/modinfo test.ko
filename:       test.ko
vermagic:       2.6.20.7-rt8 preempt mod_unload PENTIUMIII REGPARM
depends:
parm:           pConfig_file:charp
parm:           allocator_himem:An integer (int)
parm:           EnableIdleMode:An integer (int)
parm:           Board_ID:An integer (int)
parm:           Diagnostic:An integer (int)

$ hexdump -C test.ko | grep -A2 struct_
000752e0  17 98 07 0e 73 74 72 75  63 74 5f 6d 6f 64 75 6c 
|....struct_modul|
000752f0  65 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|e...............|
00075300  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|

I think this means that, in this module, the checksum for symbol 
struct_module is 0x1798070e, right?

Is there a simpler way to list all the checksums?

Regards.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-06-19 14:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-19 11:59 Dumping the checksums in a module John Sigler
2007-06-19 13:18 ` Arjan van de Ven
2007-06-19 14:40   ` John Sigler
  -- strict thread matches above, loose matches on Subject: below --
2007-05-18 15:02 John Sigler
2007-05-18 20:27 ` Jan Engelhardt
2007-05-18 20:46   ` Sam Ravnborg
2007-05-22  8:19     ` John Sigler
2007-05-22  8:13   ` John Sigler
2007-05-22 19:53     ` Jan Engelhardt
2007-05-23 15:18       ` John Sigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).