2009-01-20 17:37:14

by Shawn Bohrer

[permalink] [raw]
Subject: Modversions and long symbol names

Currently when modversions is enabled the kernel will not load any
modules that depend on exported symbols with names longer than
64 - sizeof(unsigned long) characters.

This is because the struct modversion_info has the name member set to a
size of MODULE_NAME_LEN. This is not the module name this is the symbol
name so I'm guessing this is a mistake or at least a misused constant.

Is it possible to increase this size to something more reasonable like
512 characters?

--
Shawn


2009-01-27 23:14:42

by Shawn Bohrer

[permalink] [raw]
Subject: Re: Modversions and long symbol names

On Tue, Jan 20, 2009 at 11:36:36AM -0600, Shawn Bohrer wrote:
> Currently when modversions is enabled the kernel will not load any
> modules that depend on exported symbols with names longer than
> 64 - sizeof(unsigned long) characters.
>
> This is because the struct modversion_info has the name member set to a
> size of MODULE_NAME_LEN. This is not the module name this is the symbol
> name so I'm guessing this is a mistake or at least a misused constant.
>
> Is it possible to increase this size to something more reasonable like
> 512 characters?

Hopefully everyone is back from linux.conf.au and is caught up on email
now. Is there a reason modversions imposes this small symbol name
length? Unfortunately I have modules that have longer exported symbol
names and this prevents them from loading on kernels that have
modversions enabled. Of course they load just fine when modversions is
disabled. I can't just shorten my symbol names because they are
exported and other modules are using them.

--
Shawn

2009-01-28 13:09:19

by Rusty Russell

[permalink] [raw]
Subject: Re: Modversions and long symbol names

On Wednesday 21 January 2009 04:06:36 Shawn Bohrer wrote:
> Currently when modversions is enabled the kernel will not load any
> modules that depend on exported symbols with names longer than
> 64 - sizeof(unsigned long) characters.
>
> This is because the struct modversion_info has the name member set to a
> size of MODULE_NAME_LEN. This is not the module name this is the symbol
> name so I'm guessing this is a mistake or at least a misused constant.

Yes, it's overloaded.

> Is it possible to increase this size to something more reasonable like
> 512 characters?

Oh, you almost had me. Almost.

This *looks* like the kind of naive question a newbie would ask. And a poor coder would simply patch in the increase. A reasonable coder would also make a comment about the potential bloat. A good coder would ask why you need more than fifty_five_characters_in_one_single_exported_identifier.

But you're operating on a completely different level!

You chose this example to demonstrate, by (if I may) expandio ad absurdum, that our current approach is flawed. Obviously you *knew* that it could be converted to a pointer, and equally obviously this would require us to process relocations before parsing version symbols. Clearly, you understood that this would mean we had to find another solution for struct module versioning, but you knew that that was always the first symbol version anyway.

You no-doubt knew that we could potentially save 7% on our module size using this approach. But obviously not wanting to criticize my code, you instead chose this oh-so-subtle intimation where I would believe the triumph to be mine alone!

I am humbled by your genius, and I only hope that my patch series approaches the Nirvanic perfection you foresaw.

Kudos Shawn, kudos!
Rusty.