I'm wondering if there is a better place for question of this nature, but:
I'm having major problems with a custom module on Fedora Core 3 systems, and also Red Hat EL 4. When doing an insmod, I get a segfault, and the syslog messages included below. A variant of the driver source code is also attached to this message - this is a module containing only a simplified version of the init code triggering the crash, which reproduces the problem quite nicely.
Any ideas what is wrong?
Mar 16 17:37:25 hai kernel: Unable to handle kernel paging request at virtual address 693e3660 Mar 16 17:37:25 hai kernel: printing eip: Mar 16 17:37:25 hai kernel: c01d9141 Mar 16 17:37:25 hai kernel: *pde = 00000000 Mar 16 17:37:25 hai kernel: Oops: 0000 [#1] Mar 16 17:37:25 hai kernel: Modules linked in: itifg8tst loop nfsd exportfs lp nfs lockd sunrpc video button battery ac md5 ipv6 parport_pc parport via686a i2c_sensor i2c_core 3c59x mii floppy dm_snapshot dm_zero dm_mirror ext3 jbd dm_mod aic7xxx sd_mod scsi_mod Mar 16 17:37:25 hai kernel: CPU: 0 Mar 16 17:37:25 hai kernel: EIP: 0060:[<c01d9141>] Not tainted VLI Mar 16 17:37:25 hai kernel: EFLAGS: 00010217 (2.6.11.4-0.EL.toralf) Mar 16 17:37:25 hai kernel: EIP is at pci_find_subsys+0xef/0x1a2 Mar 16 17:37:25 hai kernel: eax: 00000000 ebx: 693e363c ecx: ffffffff edx: 693e363c Mar 16 17:37:25 hai kernel: esi: ffffffff edi: ce96df1c ebp: 00000021 esp: ce96df78 Mar 16 17:37:25 hai kernel: ds: 007b es: 007b ss: 0068 Mar 16 17:37:25 hai kernel: Process insmod (pid: 6894, threadinfo=ce96c000 task=d6c40f70) Mar 16 17:37:25 hai kernel: Stack: ffffffff 00000000 0045f378 ce96c000 c01d91ff ffffffff ce96df38 e0978053 Mar 16 17:37:25 hai kernel: ffffffff ffffffff 00000000 00000000 e0912580 00000000 e0912580 c013687d Mar 16 17:37:25 hai kernel: 0804a018 00000000 c0103281 0804a018 00000d96 0804a008 00000000 0045f378 Mar 16 17:37:25 hai kernel: Call Trace: Mar 16 17:37:25 hai kernel: [<c01d91ff>] pci_find_device+0xb/0xe Mar 16 17:37:25 hai kernel: [<e0978053>] iti_os_attach+0x53/0x60 [itifg8tst] Mar 16 17:37:25 hai kernel: [<c013687d>] sys_init_module+0x1dd/0x2b6 Mar 16 17:37:25 hai kernel: [<c0103281>] sysenter_past_esp+0x52/0x75 Mar 16 17:37:25 hai kernel: Code: cf db 31 c0 c7 05 10 f6 35 c0 aa 00 00 00 74 04 8b 13 eb 4c 8b 15 e8 f2 35 c0 eb 44 81 fa e8 f2 35 c0 74 40 83 fd ff 89 d3 74 08 <0f> b7 42 24 39 e8 75 2b 83 ff ff 74 08 0f b7 43 26 39 f8 75 1e
#include <linux/version.h> /* LINUX_VERSION_CODE */ #include <linux/pci.h> /* pci specific stuff */ #ifdef MODULE #include <linux/module.h> /* init_/cleanup_ module */ MODULE_DESCRIPTION("CorecoImaging device driver test"); MODULE_AUTHOR("Matthias Stein"); #if LINUX_VERSION_CODE >= 0x02040a /* 2.4.10 */ MODULE_LICENSE("GPL"); #endif #define ITI_LOG_STRING "itifg " int iti_printi (const char *fmt, ...) { int retval; char string[80] = KERN_INFO ITI_LOG_STRING; long a, b, c, d; va_list argptr; strcat (string, fmt); va_start (argptr, fmt); a = va_arg (argptr, long); b = va_arg (argptr, long); c = va_arg (argptr, long); d = va_arg (argptr, long); retval = printk (string, 'I', a, b, c, d); va_end (argptr); return retval; } static int __exit iti_os_detach (void) { return 0; } static __init int iti_os_attach (void) { struct pci_dev *the_dev; iti_printi("Scanning all devices...\n"); the_dev=NULL; while((the_dev=pci_find_device(PCI_ANY_ID, PCI_ANY_ID, the_dev))) { iti_printi("Slot %s: Device %04hx:%04hx\n", the_dev->slot_name, the_dev->vendor, the_dev->device); } return 0; } #endif /* MODULE */ module_init(iti_os_attach); module_exit(iti_os_detach);