lkml.org 
[lkml]   [1997]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectREPOST: Fatal section alignment bug in module handling (Linux 2.1.20)
Date
[ I already posted this message a few days ago, but I never saw it
turn up on the mailing list; so here is a repost. ]

The new-style module handling as available in Linux 2.1.20 (with the
patches from modutils-970103.tar.gz) suffers from a fatal alignment
problem. There is a similar bug in the handling of the exception
tables.

A Linux 2.1.20 kernel image has (among others) these section:
".kstrtab", "__ksymtab", ".fixup", "__ex_table". The beginning and end
of the sections "__ksymtab" and "__ex_table" is marked by the symbols
"__start___ksymtab"/"__stop___ksymtab" and
"__start___ex_table"/"__stop___extable". While the beginning of the
sections gets properly aligned according to the type of data that it
contains, the symbols do not get aligned. "__start___ksymtab" does not
actually point to the beginning of "__ksymtab", but to the end of
".kstrtab"; thus it can be off by up to three bytes. Obviously, this
will result in kernel "oops's" when trying to use modules.

As I could not find any documentation on how the "__start" and
"__stop" symbols were created (does anybody care to elaborate?), I
cludged the code in "include/linux/module.h" to force stronger
alignment. This is not the proper solution, though! A correct solution
would ensure that "__start" always points to the actual beginning of
the new segment.

If you notice the same problems, but you are desperate to test Linux
2.1.20, then as a work-around use this definition in
"include/linux/module.h":

#define __EXPORT_SYMBOL(sym, str) \
const struct { char s[sizeof(str)]; \
char __attribute__ ((aligned(4))) a[0];} \
__kstrtab_##sym __attribute__((section(".kstrtab"))) \
= { str }; \
const struct module_symbol __ksymtab_##sym \
__attribute__((section("__ksymtab"))) = \
{ (unsigned long)&sym, (char *)& __kstrtab_##sym }



Markus

--
Markus Gutschke Internet: gutschk@math.uni-muenster.de
Schlage 5a PGP public key: finger -l gutschk@math.uni-muenster.de
D-48268 Greven-Gimbte
Germany >>> I prefer encrypted e-mail <<<

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.032 / U:3.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site