Re: enbd_ioctl 2.6.9 kernel fails to modprobe enbd - seg fault

scunacc <[email protected]> Fri, 03 Mar 2006 06:38:31 -0500
Newsgroups gmane.linux.enbd.general
Message-ID <1141385911.4432.165.camel@scuna-gate>
Dear Peter,

> > /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd_base.c:2859: warning:
> > conflicting types for built-in function ___log2___
> 
> There's a problem. I have defined a function that conflicts with their
> internal
> 
>   static inline unsigned
>   log2 (unsigned arg)
> 
> Please change the name to "mylog2"  throughout.

Now done that. Recompiled.

> It's a compiler bug ... my definition should win, but it hasn't.

I agree.

> 
> > /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
> 
> Unimportant.

Agreed.

> > /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
> 
> OK.
> 
> Rest is OK too.

Agreed.

> > -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___:
> 
> Interesting ...
> 
> > /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
> 
> They're right. I'll do something about that.

OK. 

> > /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
> 
> Ditto.

OK.

> > -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
> 
> Looks happy.

OK.

> > So, I did make install as well, and got:
> Just insmod /tmp/enbd/linux-2.6.x/drivers/block/enbd/enbd.ko please.

I've done that too, previously. I'll try again and see. I'll let you
know in a few minutes.

> > modprobe enbd 
> > 
> > still doesn't work...
> 
> No guarantee right one chosen.

Howso? It's the only one there 

> Do insmod (NOT modprobe). 

Will do.

> We'll have to instrument the init_module. 

Hmm.

> I
> think the trace says death occurs in blk_queue_max_sectors
> (ll_rw_blk.c) at the line
> 
>    q->max_sectors = q->max_hw_sectors = max_sectors;
> 
> 
> > EFLAGS: 00010212   (2.6.9-cm46customVM) 
> > EIP is at blk_queue_max_sectors+0x34/0x47
> 
> Which presumably means q = 0. The call is from enbd_init_queue, first
> line
> 
>      blk_queue_max_sectors (queue, buf_sectors); 
> 
> and "queue" is passed in as the secnd arg of enbd_init_queue:
> 
>      static void
>      enbd_init_queue (struct enbd_device *lo, struct request_queue *queue)
> 
> and the call is from enbd_init:
> 
>      enbd_init_queue(lo, disk->queue);
> 
> but that call is guarded:
> 
>                 disk->queue = blk_init_queue(do_enbd_request, &lo->lock);
>                 if (!disk->queue) {
>                         put_disk(disk);
>                         lo->disk = NULL;
>                         ENBD_ERROR(
>                             "Not enough memory to make a queue struct\n");
>                         goto out_nomem;
>                 }
>                 enbd_init_queue(lo, disk->queue);
>  
> So on the face of it, the report is impossible. Please use insmod.

OK. I'll do that again and get back to you shortly.

Kind regards

Derek.