* [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout
@ 2009-07-23 14:12 Rusty Russell
0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2009-07-23 14:12 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier@gentoo.org>
The check_modstruct_version() needs to look up the symbol "module_layout"
in the kernel, but it does so literally and not by a C identifier. The
trouble is that it does not include a symbol prefix for those ports that
need it (like the Blackfin and H8300 port). So make sure we tack on the
MODULE_SYMBOL_PREFIX define to the front of it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
kernel/module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1068,7 +1068,8 @@ static inline int check_modstruct_versio
{
const unsigned long *crc;
- if (!find_symbol("module_layout", NULL, &crc, true, false))
+ if (!find_symbol(MODULE_SYMBOL_PREFIX "module_layout", NULL,
+ &crc, true, false))
BUG();
return check_version(sechdrs, versindex, "module_layout", mod, crc);
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: module version magic and arches with symbol prefixes
@ 2009-06-19 5:38 Rusty Russell
2009-06-19 7:49 ` [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout Mike Frysinger
0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2009-06-19 5:38 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Linux kernel mailing list, Robin Getz
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. Better to fail spectacularly:
ideally we'd do this find in an init routine and guarantee a boot crash.
Thanks,
Rusty.
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout
2009-06-19 5:38 module version magic and arches with symbol prefixes Rusty Russell
@ 2009-06-19 7:49 ` Mike Frysinger
2009-06-19 14:02 ` Rusty Russell
0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-06-19 7:49 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel, Robin Getz
The check_modstruct_version() needs to look up the symbol "module_layout"
in the kernel, but it does so literally and not by a C identifier. The
trouble is that it does not include a symbol prefix for those ports that
need it (like the Blackfin and H8300 port). So make sure we tack on the
MODULE_SYMBOL_PREFIX define to the front of it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
kernel/module.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 80036bc..7850bef 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1053,7 +1053,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
{
const unsigned long *crc;
- if (!find_symbol("module_layout", NULL, &crc, true, false))
+ if (!find_symbol(MODULE_SYMBOL_PREFIX "module_layout", NULL,
+ &crc, true, false))
BUG();
return check_version(sechdrs, versindex, "module_layout", mod, crc);
}
--
1.6.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout
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
0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2009-06-19 14:02 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-kernel, Robin Getz
On Fri, 19 Jun 2009 05:19:22 pm Mike Frysinger wrote:
> The check_modstruct_version() needs to look up the symbol "module_layout"
> in the kernel, but it does so literally and not by a C identifier. The
> trouble is that it does not include a symbol prefix for those ports that
> need it (like the Blackfin and H8300 port). So make sure we tack on the
> MODULE_SYMBOL_PREFIX define to the front of it.
Thanks, applied. I'm surprised this took so long to find.
Rusty.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout
2009-06-19 14:02 ` Rusty Russell
@ 2009-06-19 18:29 ` Mike Frysinger
0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-06-19 18:29 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel, Robin Getz
On Fri, Jun 19, 2009 at 10:02, Rusty Russell wrote:
> On Fri, 19 Jun 2009 05:19:22 pm Mike Frysinger wrote:
>> The check_modstruct_version() needs to look up the symbol "module_layout"
>> in the kernel, but it does so literally and not by a C identifier. The
>> trouble is that it does not include a symbol prefix for those ports that
>> need it (like the Blackfin and H8300 port). So make sure we tack on the
>> MODULE_SYMBOL_PREFIX define to the front of it.
>
> Thanks, applied. I'm surprised this took so long to find.
well, technically i first noticed on 2007-10-24, but the fix that went
in internally sucked and people forgot about it ;)
-mike
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-23 14:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 14:12 [PATCH] module: use MODULE_SYMBOL_PREFIX with module_layout Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2009-06-19 5:38 module version magic and arches with symbol prefixes 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox