2.6.13: loop ioctl crashes

From: Ian Collier
Date: Fri Sep 09 2005 - 07:28:34 EST


I'm trying out PPDD from https://retiisi.dyndns.org/~sailus/ppdd/
because I have some old stuff in that format. However, the crash
seems to occur in code that isn't touched by the PPDD patch. It
happens while I'm trying to set up the loop device - I haven't got
as far as actually using it yet.

If I'm lucky then when I issue the losetup command and successfully
type in the passphrase then losetup says something of the form
ioctl: LOOP_SET_STATUS: Bad address
and the kernel says:

Debug: sleeping function called from invalid context at arch/i386/lib/usercopy.c:634
in_atomic():1, irqs_disabled():0
[<c011f8eb>] __might_sleep+0xab/0xc0
[<c0211aa3>] copy_from_user+0x23/0x90
[<d0a9fe80>] loop_set_status_old+0x30/0x70 [loop]

However, it often seems to panic in a variety of horrible ways while
trying to print the above message.

Clearly I have CONFIG_DEBUG_SPINLOCK_SLEEP set (as my config is
based on Fedora's), and I suppose I could just try unsetting it to
make the message go away. That wouldn't make the underlying bug go
away, though. If it makes any difference, loop and all the crypto
algorithms are compiled as modules.

I don't understand why it's an invalid context. I also don't understand
why the traceback stops at loop_set_status_old given that it must have
been called from lo_ioctl. (But maybe the answer to the latter would
explain the former.)

I may try just moving the copy_from_user() out to the beginning of
lo_ioctl and see what happens. Any other suggestions? In case it's
not obvious by now, I'm not really a kernel hacker.

imc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/