Subject: oops message

From: Dave Baukus <[email-masked]>
Date: Tue, 10 Aug 1999 13:36:50 -0500

I have two driver modules that I am trying to load into the
2.2.10-rmk2 kernel on an ebsa285. Each module was ported to linux and tested
on an ix86 platform. Under ARM linux each driver fails to load due to
an exception. The exception appears to be related to dereferencing a NULL
pointer. In following kernel oops message the PC appears to be in memset.
The code is not that broken that we are passing a NULL pointer to memset.

The call to memset is something like memset(&foo, 0, sizeof(struct foo));
where foo is declared statically in one of the *.c files of the driver.

Any clues ? It almost appears as if the .data section is not getting
relocated into the kernel address space when I do an insmod, but that's
just wild speculation at this point.

--
[email-masked]
	Inet Technologies Inc.
	Plano, Texas

Subject: oops message
From: Shuping Zhou <[email-masked]>
To: [email-masked]
Date: Tue, 10 Aug 1999 12:02:03 -0500

Unable to handle kernel paging request at virtual address 00002600
memmap = 00BCC000, pgd = c0bcc000
*pgd = 00946001, *pmd = 00946001, *pte = 00000000, *ppte = 00000000
Internal error: Oops: 0
CPU: 0
pc : [<c00f2c08>]    lr : [<00000000>]
sp : c0b8fec0  ip : 0000000f  fp : c0b8fed8
r10: 400fd554  r9 : ffffffea  r8 : c1817048
r7 : c181f23c  r6 : 00000000  r5 : 00000000  r4 : 00002600
r3 : 00002600  r2 : 00000000  r1 : 00000000  r0 : 00002600
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: BCC171  Table: 00BCC171  DAC: 00000015
Process insmod (pid: 288, stackpage=c0b8f000)
Stack:
c0b8fea0:                                      00000000 c00f2c08
20000013 ffffffff
c0b8fec0: c1817b5c 00002600 c181f030 c0b8fef4  c0b8fedc c181869c
c1817b44 c181f030
c0b8fee0: c181ed18 00000000 c0b8ff0c c0b8fef8  c1818758 c1818628
c1818fec 000000fe
c0b8ff00: c0b8ff28 c0b8ff10 c181be28 c18186f4  00000000 c1817000
00000000 c0b8ffb0
c0b8ff20: c0b8ff2c c00286dc c181bdc0 00000003  c1817048 c0b8ff3c
c1817048 c0de0000
c0b8ff40: c0d9a000 00000048 c0120eb8 c1817048  0000823c 00000000
00000000 00000000
c0b8ff60: 00000000 00000000 00000000 00000000  00000000 00000000
00000000 00000000
c0b8ff80: 00000000 00000000 00000000 02047510  c0017f28 00000080
c0b8e000 c0b8fff4
c0b8ffa0: 0200f020 00000000 c0b8ffb4 c0017da0  c00280ec 02047510
0200f020 02047510
c0b8ffc0: 0200f020 02047510 02047510 020100f0  0200effc c1817000
0000823c 0200f020
c0b8ffe0: 400fd554 bffffcd4 bffffcd8 bffffcc4  02003314 02005b8c
60000010 0200f020
Backtrace:
Function entered at [<c1817b38>] from [<c181869c>]
  r5 = c181f030
  r4 = 00002600
Function entered at [<c181861c>] from [<c1818758>]
  r6 = 00000000
  r5 = c181ed18
  r4 = c181f030
Function entered at [<c18186e8>] from [<c181be28>]
  r4 = 000000fe
Function entered at [<c181bdb4>] from [<c00286dc>]
  r6 = 00000000
  r5 = c1817000
  r4 = 00000000
Function entered at [<c00280e0>] from [<c0017da0>]
  r9 = 0200f020
  r8 = c0b8fff4
  r7 = c0b8e000
  r6 = 00000080
  r5 = c0017f28
  r4 = 02047510
Code: e1a0e001 e25cc004 (a8a34002) a8a34002 a8a34002

---

From: Dave Baukus <[email-masked]>
Date: Fri, 13 Aug 1999 17:06:12 -0500

I'm having trouble dynamically loading modules into the 
2.2.10-rmk2 kernel. I have broken the problem down to
a very trivial kernel module; it consists of the following 2 
C files:

fooX.c:
---------------------------------

#define MODVERSIONS
#include <linux/modversions.h>
#define EXPORT_SYMTAB
#include <linux/module.h>
#include <linux/version.h>  
#include <linux/kernel.h>       /* printk() */

extern void foo(void);

int 
init_module(void)
{

        printk("init_module: entered\n");

        foo();

        printk("init_module: exit\n");
        return 0;
}

void 
cleanup_module(void)
{
        printk("cleanup_module:  entered\n");
        printk("cleanup_module:  exit\n");
}

fooY.c
------------------------------------
	
#define MODVERSIONS
#include <linux/modversions.h>
#include <linux/kernel.h>       /* printk() */

void foo(void)
{
        printk("foo enter ");
        printk("foo ");
        printk("foo ");
        printk("foo ");
        printk("foo exit\n");
}

----------
I build it like:

/opt/INETlgnu/bin/armv4l-inet-linux-gcc -o fooX.o -mapcs-32 -mshort-load-bytes
-mcpu=strongarm110 -Wall -O2 -pipe -Wstrict-prototypes -D DEBUG=4 -D __KERNEL__
-D MODULE -c fooX.c

/opt/INETlgnu/bin/armv4l-inet-linux-gcc -o fooY.o -mapcs-32 -mshort-load-bytes
-mcpu=strongarm110 -Wall -O2 -pipe -Wstrict-prototypes -D DEBUG=4 -D __KERNEL__
-D MODULE -c fooY.c

/opt/INETlgnu/bin/armv4l-inet-linux-ld -o foo.o  -r fooX.o fooY.o

----------------

Every time this module is loaded it gets kernel Ooops
from, I think, printk() or on the return from printk().

The funny thing is that if put the function foo() in the
fooX.c source file, thus reducing the module to 1 .o file,
then the module loads and print, and unloads as expected.

Am I building this thing wrong ?
Suggestions, please.
 
--
[email-masked]
	Inet Technologies Inc.
	Plano, Texas
unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Sun, 22 Aug 1999 13:23:30 +0100

>a very trivial kernel module; it consists of the following 2 

What versions of the tools (binutils and modutils) are you using?  Some 
versions of ld had problems with incrementental links and some versions of 
modutils would get branches wrong under some circumstances.

p.

---

From: Dave Baukus <[email-masked]>
Date: Sun, 22 Aug 1999 10:09:58 -0500

> modutils would get branches wrong under some circumstances.

	Binutils = 2.9.1.0.21-1 
	Modutils = 2.1.121

---

From: Philip Blundell <[email-masked]>
Date: Sun, 22 Aug 1999 16:41:58 +0100

>	Modutils = 2.1.121

Neither of those are really the best.  I've put an unofficial modutils 
snapshot in <ftp://ftp.netwinder.org/users/p/philb/modutils-990822.tar.bz2> 
and you might like to try that with binutils 2.9.5.0.7 or whatever HJ's latest 
beta is.

p.