[2.1.24] module work around

PARMELAN Edouard (parmee@postecss.ncrfran.france.ncr.com)
Mon, 03 Feb 97 18:58:00 PST


> I use Linux 2.1.23 + modutils-2.1.23 + 21-module-load-fix.patch on an
old > i386+i387 and I have many OOPS with depmod, insmod AND cat
/proc/ksyms :(
>
> After some kaffe, I show from my System.map:
> xxxxxx89 A __start___ksymtab
> xxxxxx8c ? __ksymtab_xxxxxxxxx
>
> Oops __start___ksymtab don't match the first symbol !
>
> How to fix this bug ?
>
> Edouard.Parmelan@France.NCR.COM

>From System.map
c019099c ? __kstrtab_scsi_devices
c01909a9 A __start___ksymtab
c01909ac ? __ksymtab_EISA_bus

objdump --section-headers vmlinux
SECTION 2 [__ksymtab] : size 00000a00 vma c01909ac lma c01909ac align
2**2
ALLOC, LOAD, READONLY, DATA

Humm, __start___ksymtab is not in section __ksymtab :(
May be a gcc-2.7.2 or binutils-2.6 bug ?

The fallowing patch is a work around for guys who don't want download
binutils and libc and others stuff broken by the upgrade.

Edouard.Parmelan@France.NCR.COM

[This patch include the 21-module-load-fix.patch: (strlen(s->name)]
--- linux-2.1/kernel/module.c-24 Wed Jan 29 21:22:09 1997
+++ linux-2.1/kernel/module.c Sat Feb 1 09:22:43 1997
@@ -63,6 +63,14 @@
void init_modules(void)
{
kernel_module.nsyms = __stop___ksymtab - __start___ksymtab;
+ {
+ int fixup = ((long)__stop___ksymtab - (long)__start___ksymtab) %
sizeof(struct module_symbol);
+
+ if(fixup != 0) {
+ printk(KERN_WARNING "init_modules: fixup %d\n", fixup);
+ kernel_module.syms = (void*)kernel_module.syms + fixup;
+ }
+ }

#ifdef __alpha__
{
@@ -583,7 +591,7 @@

calc_space_needed:
for (; i < mod->nsyms; ++i, ++s)
- space += strlen((++s)->name)+1;
+ space += strlen(s->name)+1;

if (put_user(space, ret))
return -EFAULT;