[ENBD] enbd_ioctl 2.6.9 kernel fails to modprobe enbd - seg fault

scunacc scunacc at yahoo.com
Thu Mar 2 18:45:34 MST 2006


Dear Peter et al.,

For the rest of these, I moved the prototypes up.

> Oh. It's another prototype.
> 
>     static inline int rq_type(struct request *);
>     int type = rq_type(req);
> 
> There's no easy way round that. Perhaps ... moving the prototype up out
> of the function might help. Hard to tell. My compiler (2.95.4) is
> happy with that move.
> 
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:444: warning: implicit declaration of function ___rq_type___
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h: In function ___enbd_end_request___:
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:485: error: invalid storage class for function ___rq_set_seqno___
> 
> 
> Another prototype:
> 
>      static void rq_set_seqno(struct request *, unsigned long);
> 
> Move it up.
> 
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:487: warning: implicit declaration of function ___rq_set_seqno___
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h: In function ___enbd_end_request_lock___:
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:500: error: invalid storage class for function ___rq_set_seqno___
> 
> Same thing. Remove.
> 
>     static void rq_set_seqno(struct request *, unsigned long);
> 
> 
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c: At top level:
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:495: error: static
> > declaration of ___rq_type___ follows non-static declaration
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:444: error: previous implicit declaration of ___rq_type___ was here
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:627: warning:
> > conflicting types for ___rq_set_seqno___
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:627: error: static
> > declaration of ___rq_set_seqno___ follows non-static declaration
> > /home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:487: error: previous implicit declaration of ___rq_set_seqno___ was here
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c: In function
> > ___enbd_get_req___:
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:1878: error:
> > invalid storage class for function ___enbd_clr_sock___
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:1924: warning:
> > implicit declaration of function ___enbd_clr_sock___
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c: At top level:
> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:2628: error: static
> > declaration of ___enbd_clr_sock___ follows non-static declaration
> 
> We'll work on that one next time.

I did them all in one go.

Now it compiles thru to here cleanly:

# make module 2>&1
make[1]: Entering directory `/usr/src/linux-2.6.9-cm46'
*** Warning: Overriding SUBDIRS on the command line can cause
***          inconsistencies
mkdir -p /tmp/enbd/linux-2.6.x/.tmp_versions
make -f /usr/src/linux-2.6.9-cm46/scripts/Makefile.build
obj=arch/i386/kernel arch/i386/kernel/asm-offsets.s
make[2]: `arch/i386/kernel/asm-offsets.s' is up to date.
  CHK     include/asm-i386/asm_offsets.h
make -f /usr/src/linux-2.6.9-cm46/scripts/Makefile.build
obj=/tmp/enbd/linux-2.6.x/drivers/block/enbd
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_base.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_base -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_base.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c
/tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:2859: warning:
conflicting types for built-in function ‘log2’
/tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c: In function
‘enbd_ioctl’:
/tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:4423: warning:
pointer targets in passing argument 1 of
‘remote_ioctl->convert_inplace’ differ in signedness
/tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c: At top level:
/tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:4531: warning:
‘enbd_read_block_0’ defined but not used
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_ioctl_stub.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_ioctl_stub -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_ioctl_stub.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl_stub.c
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_seqno.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_seqno -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_seqno.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_seqno.c
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_md.o.d -nostdinc
-iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__ -Iinclude
-Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_md -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_md.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_md.c
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_speed.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_speed -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_speed.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_speed.c
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_proc.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_proc -DKBUILD_MODNAME=enbd -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_proc.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_proc.c
  ld -m elf_i386  -r
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl_stub.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_seqno.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_md.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_speed.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_proc.o
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_ioctl.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC  -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include"
-DKBUILD_BASENAME=enbd_ioctl -DKBUILD_MODNAME=enbd_ioctl -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/.tmp_enbd_ioctl.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.c
In file included
from /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.c:26:
/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd_ioctl_table.h: In function ‘new_IO_copy_from_user’:
/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd_ioctl_table.h:761: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_result
/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd_ioctl_table.h: In function ‘new_IO_copy_to_user’:
/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd_ioctl_table.h:776: warning: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result
  Building modules, stage 2.
make -rR -f /usr/src/linux-2.6.9-cm46/scripts/Makefile.modpost
VPATH=/usr/src/linux-2.6.9-cm46
  scripts/mod/modpost -m -o /usr/src/linux-2.6.9-cm46/Module.symvers
vmlinux /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.o
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd.mod.o.d -nostdinc
-iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__ -Iinclude
-Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC   -DKBUILD_BASENAME=enbd -DKBUILD_MODNAME=enbd
-DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include" -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.mod.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.mod.c
  ld -m elf_i386 -r
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.ko /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.mod.o
  gcc -I/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include
-Wp,-MD,/tmp/enbd/linux-2.6.x/drivers/block/enbd/.enbd_ioctl.mod.o.d
-nostdinc -iwithprefix include -D__KERNEL__ -Iinclude  -D__KERNEL__
-Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -pipe -msoft-float     -Iinclude/asm-i386/mach-default -O2
-fomit-frame-pointer -Wdeclaration-after-statement -D__SMP__
-DCONFIG_X86_LOCAL_APIC   -DKBUILD_BASENAME=enbd_ioctl
-DKBUILD_MODNAME=enbd_ioctl -DMODULE
-I"/home/sysadmin/net_disk/nbd-2.4.33/kernel/linux-2.6.x/include" -c
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.mod.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.mod.c
  ld -m elf_i386 -r
-o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.ko /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.o /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_ioctl.mod.o
make[1]: Leaving directory `/usr/src/linux-2.6.9-cm46'
# 

I.e. it ran thru' to completion

(Just like before I started the thread... :-)

So, I did make install as well, and got:

ls -lart /lib/modules/2.6.9-cm46customVM/misc
-rwxr-xr-x  1 root root 95266 Mar  2 20:45 enbd.ko
-rwxr-xr-x  1 root root  7874 Mar  2 20:45 enbd_ioctl.ko

and

ls -lart /usr/local/sbin/
-rwxr-xr-x   1 root root 144733 Mar  2 20:45 enbd-server
-rwxr-xr-x   1 root root  18205 Mar  2 20:45 enbd-sstatd
-rwxr-xr-x   1 root root 138498 Mar  2 20:45 enbd-client
-rwxr-xr-x   1 root root  23270 Mar  2 20:45 enbd-cstatd
-rwxr-xr-x   1 root root  23963 Mar  2 20:45 enbd-test
-rwxr-xr-x   1 root root   8959 Mar  2 20:45 enbd-maketest

Guess what.

modprobe enbd 

still doesn't work...

dmesg o/p:

ENBD #5427[0]: enbd_init Network Block Device originally by
pavel at elf.mj.gts.cz
ENBD #5428[0]: enbd_init Network Block Device port to 2.0 by
ptb at it.uc3m.es
ENBD #5430[0]: enbd_init Network Block Device move networking to user
space by amarin at it.uc3m.es
ENBD #5432[0]: enbd_init Enhanced Network Block Device 2.4.30 $Date:
2002/09/17 16:33:22 $ by ptb at it.uc3m.es
Unable to handle kernel NULL pointer dereference at virtual address
000003ae
 printing eip:
c024d815
*pde = 36d96001
Oops: 0002 [#1]
SMP 
Modules linked in: enbd nfsd exportfs lockd ipv6 vmhgfs bproc vmadump
sunrpc dm_mod button battery ac uhci_hcd shpchp snd_ens1371 snd_rawmidi
snd_seq_device snd_pcm_oss snd_mixer_oss snd_pcm snd_timer
snd_page_alloc snd_ac97_codec snd soundcore pcnet32 mii vmxnet floppy
BusLogic
CPU:    0
EIP:    0060:[<c024d815>]    Tainted: P   VLI
EFLAGS: 00010212   (2.6.9-cm46customVM) 
EIP is at blk_queue_max_sectors+0x34/0x47
eax: 00001600   ebx: 00000200   ecx: 00000003   edx: 0000000b
esi: f7879960   edi: f8a0eb60   ebp: f8a0d040   esp: f6d63c54
ds: 007b   es: 007b   ss: 0068
Process modprobe (pid: 2821, threadinfo=f6d63000 task=c29f3360)
Stack: c043b9a0 f7ecdc80 f6d63000 f7ecdc80 f88c0165 f7879960 00000200
00000000 
       f8a0adbc b7fd8007 f7eceb94 00160019 f7eceba0 f8a0cd24 f7d6ed00
00000000 
       00000000 f6d8edf8 f7d6ed00 c0144715 f7890320 00000001 f8a0eb54
b7fd8007 
Call Trace:
 [<f88c0165>] init_module+0x165/0xeb0 [enbd]
 [<c0144715>] pte_alloc_map+0x34/0xe1
 [<c0146d8b>] handle_mm_fault+0x186/0x1ce
 [<c01567a2>] __find_get_block+0xe0/0x11d
 [<c011871d>] do_page_fault+0x270/0x6e0
 [<c013bdc1>] buffered_rmqueue+0xce/0x1cc
 [<c011becd>] __wake_up+0x32/0x43
 [<c019ba05>] journal_stop+0x196/0x273
 [<c011bbd3>] scheduler_tick+0x263/0x4c6
 [<c013bdc1>] buffered_rmqueue+0xce/0x1cc
 [<c013bf55>] __alloc_pages+0x96/0x2ef
 [<c013fa34>] cache_init_objs+0x73/0xa3
 [<c013fbce>] cache_grow+0x10a/0x18e
 [<c016a303>] alloc_inode+0x143/0x14a
 [<c0114de7>] do_flush_tlb_all+0x0/0x5a
 [<c0114e94>] smp_call_function+0x1e/0xf6
 [<c01694a3>] d_instantiate+0x21/0x47
 [<c014bbf0>] unmap_area_pmd+0x43/0x5a
 [<c014c16b>] __vunmap+0x3b/0xd3
 [<c0135362>] load_module+0x8e1/0xa21
 [<f88c0000>] init_module+0x0/0xeb0 [enbd]
 [<c0135586>] sys_init_module+0xe4/0x1fb
 [<c0105cf5>] sysenter_past_esp+0x52/0x71
Code: c1 e0 09 3d ff 0f 00 00 77 21 c7 44 24 08 08 00 00 00 c7 44 24 04
d8 77 48 c0 c7 04 24 3c dd 3e c0 e8 a8 20 ed ff ba 08 00 00 00 <66> 89
93 ae 01 00 00 66 89 93 ac 01 00 00 83 c4 0c 5b c3 53 83 


This is where I was on the kernel module before we started... :-(

However, we have cleaned up the compile a little.

Kind regards

Derek.



More information about the ENBD mailing list