public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* module version magic and arches with symbol prefixes
@ 2009-06-18 15:24 Mike Frysinger
  2009-06-19  5:38 ` Rusty Russell
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Frysinger @ 2009-06-18 15:24 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Linux kernel mailing list, Robin Getz

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.

i tried to hack it in the Blackfin port by add this to the linker script:
module_layout = _module_layout
but that didnt seem to work.  maybe kallsysms couldnt find it or i
need to hack a different name ...

we could add a new function to asm-generic/sections.h:
#ifndef arch_symbol_name
#define arch_symbol_name(sym) sym
#endif
and in the case of Blackfin systems, we'd do:
#define arch_symbol_name(sym) "_" sym

no other consumer of find_symbol() has a problem because they're all
dynamic -- they scan the modules for required symbols and then scan
the kernel for those, so all the symbol prefixes line up.

that would fix the find_symbol() invocation, and check_version()
wouldnt need changing because in that case, it's look for the literal
symbol that scripts/mod/modpost.c is adding -- "module_layout" in this
case.

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
-mike

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

end of thread, other threads:[~2009-06-29 12:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 15:24 module version magic and arches with symbol prefixes Mike Frysinger
2009-06-19  5:38 ` Rusty Russell
2009-06-19  7:49   ` [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout Mike Frysinger
2009-06-19 14:02     ` Rusty Russell
2009-06-19 18:29       ` Mike Frysinger
2009-06-19 12:54   ` module version magic and arches with symbol prefixes Robin Getz
2009-06-19 13:14     ` Mike Frysinger
2009-06-19 17:07       ` Robin Getz
2009-06-19 18:32         ` Mike Frysinger
2009-06-23  7:07         ` Rusty Russell
2009-06-29 12:07           ` Robin Getz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox