[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segfault on kernel v2.4.0



Hello,

I've put together a tiny script to check ciphers.  On my box only
blowfish and rc6 make the losetup segfault.  You'll find the
script attached.  It has not been thoroughly tested but it should
be OK.

Michael Driscoll reported that he can use the cipher after it has
been insmod-ed.  It is not the case here:  it doesn't matter if I
do an insmod first or not, losetup always segfaults when trying to
initialize the modules.  I also pinpointed the same ioctl where
losetup segfaults:

lomount.c:362:       (void) ioctl (fd, LOOP_SET_STATUS, loopinfo);

On Wed, Jan 31, 2001 at 05:13:21PM +0000, Marc Mutz wrote:
> Dejan Muhamedagic wrote:
> > 
> > I'll try to clarify:
> > 
> > 1.  It is a segfault (in losetup).  No oopses.
> > 
> 
> I had that, too. When trying to losetup in 2.2.18.4pre1, which uses the
> same techniques as 2.4.x.y. I was also using Blowfish.

Well, I'm not sure whether this is an oops too or not.  It does
occur in the kernel space, but it doesn't say Oops :)  Can
somebody clarify on the terminology which should be used?

> > 2.  The kernel (2.4.0) seems to be OK.  loop devices work fine.
> 
> Don't you see the loop device hangs reported by other people? Or do you
> have Jens Axboe's loop-3 patch applied?

Loop devices work fine here.  I have no idea about the patch
though.  The utils are stock util-linux-2.10o (i.e. from
ftp.kernel.org) with the crypto patch applied.

> > 4.  All ciphers are compiled as modules.
> 
> dto.
> 
> > So, I can switch to IDEA.  Is it advisable to use this cipher in a
> > production?  Any reports about its stability?  About the
> > international patch?  Or should I stay put with the v2.2.x kernels
> > for the time being?
> <snip> 
> 
> You should try to use serpent. You can use it free of charge (unlike
> IDEA, for which you must pay royalties if used commercially).

Thanks.  I'll give it a try.

> Also, if someone out there could test through the ciphers and check
> which of them make losetup segfault, this would be much appreciated. I'm
> still stuck w/ 2.2.x, but will reboot into 2.2.18.4pre1 and strace
> losetup.

Here are my results:

kernel: 2.4.0
intpatch: 2.4.0.3
utils: 2.10o
libc6: 2.2 (debian v2.2-6)

hobbes:~# ./testcrypto 
start testing aes
Password :
Password :
end testing aes
start testing blowfish
./testcrypto: line 14:  2066 Segmentation fault      losetup -k 128 -e $crypto $loopdev crypto.fs
oopsie
start testing dfc
Password :
Password :
end testing dfc
start testing idea
Password :
Password :
end testing idea
start testing mars
Password :
Password :
end testing mars
start testing rc5
Password :
Password :
end testing rc5
start testing rc6
./testcrypto: line 14:  2176 Segmentation fault      losetup -k 128 -e $crypto $loopdev crypto.fs
oopsie
start testing serpent
Password :
Password :
end testing serpent
start testing twofish
Password :
Password :
end testing twofish

I'd advise rebooting after running the script.

Cheers.

Dejan

-- 
Dejan Muhamedagic                      mailto:dejan@xsoft.at
Xsoft GmbH                               http://www.xsoft.at
Modecenterstr. 14, 1030 Vienna, Austria    +43 1 7963636 676
#
LOOPDEVS="0 1 2 3 4 5 6"
function getloopdev {
	for i in $LOOPDEVS; do
		if losetup /dev/loop$i 2>&1 | grep -qs "No such device"; then
			echo /dev/loop$i
			return
		fi
	done
}

function testcr {
	[ ! -f crypto.fs -o ! -f secret.md5 ] && {
		echo please create secret.md5 and/or crypto.fs
		echo secret.md5: data used for testing
		echo crypto.fs: a container-file for the filesystem
		return
	}
	crypto=$1
	loopdev=`getloopdev`
	[ -z "$loopdev" ] && {
		echo >&2 sorry, no loop devices available
		return
	}
	echo start testing $crypto
	losetup -k 128 -e $crypto $loopdev crypto.fs
	if [ $? -ne 0 ]; then
		echo oopsie; return
	fi
	mke2fs $loopdev >/dev/null 2>&1
	mount $loopdev /mnt
	cp secret.md5 /mnt
	umount /mnt
	losetup -d $loopdev
	if [ $? -ne 0 ]; then
		echo oopsie
		return
	fi
	losetup -k 128 -e $crypto $loopdev crypto.fs
	if [ $? -ne 0 ]; then
		echo oopsie
		return
	fi
	mount $loopdev /mnt
	cmp secret.md5 /mnt/secret.md5
	umount /mnt
	losetup -d $loopdev
	echo end testing $crypto
}
[ ! -f crypto.fs ] && {
	dd if=/dev/zero of=crypto.fs bs=1k count=256 || {
		echo sorry, not able to create crypto.fs
		exit
	}
}
testcr aes
testcr blowfish
testcr dfc
testcr idea
testcr mars
testcr rc5
testcr rc6
testcr serpent
testcr twofish