Re: module version magic and arches with symbol prefixes

From: Mike Frysinger
Date: Fri Jun 19 2009 - 09:14:29 EST


On Fri, Jun 19, 2009 at 08:54, Robin Getz wrote:
> On Fri 19 Jun 2009 01:38, Rusty Russell pondered:
>> On Fri, 19 Jun 2009 12:54:44 am Mike Frysinger wrote:
>> > the current check_modstruct_version() does this:
>> > {
>> > Â Â const unsigned long *crc;
>> >
>> > Â Â if (!find_symbol("module_layout", NULL, &crc, true, false))
>> > Â Â Â Â BUG();
>> > Â Â return check_version(sechdrs, versindex, "module_layout", mod, crc);
>> > }
>> > the trouble here is that it looks for a literal "module_layout" symbol
>> > and for ports that have symbol prefixes (a quick check shows Blackfin
>> > & h8300), this aint going to work.
>>
>> MODULE_SYMBOL_PREFIX is the fix for this, ie:
>>
>> Â Â Â if (!find_symbol(MODULE_SYMBOL_PREFIX "module_layout), ...
>>
>> > also, using BUG() here seems pretty damn harsh. Âwouldnt it make more
>> > sense to do something like:
>> > Â Â if (WARN_ON(!find_symbol("module_layout", NULL, &crc, true, false)))
>> > Â Â Â Â return 0;
>> > this way the module is simply not loaded rather than killing the kernel
>>
>> No, it means the kernel didn't build properly.
>
> Or a module didn't build properly.

nah, when i talked to you earlier i was wrong -- this find_symbol() is
looking up the symbol in the kernel, not in the module. the lookup of
the symbol in the requested module actually works.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/