Date: Wed, 04 Dec 2013 13:59:52 +0100 From: Paolo Pinto <paolo.pinto@netasq.com> To: freebsd-geom@freebsd.org Cc: nicolas dumont <nicolas.dumont@netasq.com> Subject: geom_uzip, panic: bio_length in mdstart_vnode() Message-ID: <529F2748.2060900@netasq.com>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hi list!
My kernel is compiled with option INVARIANTS and I get a reproducible
kernel panic when trying to read data from a GEOM based compressed
memory disk:
Unread portion of the kernel message buffer:
panic: bio_length 140288
cpuid = 3
KDB: stack backtrace:
#0 0xffffffff80909726 at kdb_backtrace+0x66
#1 0xffffffff808d0fa8 at panic+0x1d8
#2 0xffffffff80595949 at mdstart_vnode+0x619
#3 0xffffffff80594053 at md_kthread+0x143
#4 0xffffffff808a3145 at fork_exit+0x135
#5 0xffffffff80c6fabe at fork_trampoline+0xe
Uptime: 16m21s
Dumping 367 out of 6113 MB:..5%..14%..22%..31%..44%..53%..61%..74%..83%..92%
Loaded symbols for /boot/kernel/geom_uzip.ko
#0 doadump (textdump=<value optimized out>) at pcpu.h:234
234 pcpu.h: No such file or directory.
in pcpu.h
(kgdb) #0 doadump (textdump=<value optimized out>) at pcpu.h:234
#1 0xffffffff808d1552 in kern_reboot (howto=260)
at /data/usr/home/fabient/fabient-freebsd/sys/kern/kern_shutdown.c:449
#2 0xffffffff808d0f79 in panic (fmt=0x1 <Address 0x1 out of bounds>)
at /data/usr/home/fabient/fabient-freebsd/sys/kern/kern_shutdown.c:637
#3 0xffffffff80595949 in mdstart_vnode (sc=0xfffffe00070e5000,
bp=0xfffffe0059bf38b8)
at /data/usr/home/fabient/fabient-freebsd/sys/dev/md/md.c:742
#4 0xffffffff80594053 in md_kthread (arg=<value optimized out>)
at /data/usr/home/fabient/fabient-freebsd/sys/dev/md/md.c:945
#5 0xffffffff808a3145 in fork_exit (callout=0xffffffff80593f10
<md_kthread>,
arg=0xfffffe00070e5000, frame=0xffffff81bdc34c40)
at /data/usr/home/fabient/fabient-freebsd/sys/kern/kern_fork.c:992
#6 0xffffffff80c6fabe in fork_trampoline ()
at
/data/usr/home/fabient/fabient-freebsd/sys/amd64/amd64/exception.S:606
#7 0x0000000000000000 in ?? ()
(kgdb)
Panic is coming from a KASSERT :
KASSERT(bp->bio_length <= MAXPHYS, ("bio_length %jd",
(uintmax_t)bp->bio_length));
with MAXPHYS = 128*1024 = 131072
Environment :
$ uname -a
FreeBSD refbench 9.2-RELEASE-p1 FreeBSD 9.2-RELEASE-p1 #75
r229873+c58f3c3-dirty: Wed Dec 4 11:22:54 CET 2013
fabient@refbench:/usr/obj/data/usr/home/fabient/fabient-freebsd/sys/GENERIC
amd64
How-To-Repeat :
$ mkdir work && cd work
$ dd if=/dev/random of=data.img bs=256k count=1
1+0 records in
1+0 records out
262144 bytes transferred in 0.002899 secs (90427801 bytes/sec)
$ ls -lh
total 272
-rw-r--r-- 1 paolop devel 256k Dec 4 10:47:51 2013 data.img
$ cd -
$ makefs -t ffs -o optimization=time -o version=2 foo.img work/
Calculated size of `foo.img': 311296 bytes, 3 inodes
Extent size set to 8192
foo.img: 0.3MB (608 sectors) block size 8192, fragment size 1024
using 1 cylinder groups of 0.30MB, 38 blks, 32 inodes.
super-block backups (for fsck -b #) at:
32,
Populating `foo.img'
makefs: Writing inode 3 (work//./data.img), bytes 253952 + 8192: No
space left on device
First issue; why does this happen?
As workaround, I have to create another file/data :
$ python -c "print 'a'*300000" > work/bar.txt
$ ls -lh work/
total 592
-rw-r--r-- 1 paolop devel 293k Dec 4 10:49:22 2013 bar.txt
-rw-r--r-- 1 paolop devel 256k Dec 4 10:47:51 2013 data.img
$ makefs -t ffs -o optimization=time -o version=2 foo.img work/
Calculated size of `foo.img': 638976 bytes, 4 inodes
Extent size set to 8192
foo.img: 0.6MB (1248 sectors) block size 8192, fragment size 1024
using 1 cylinder groups of 0.61MB, 78 blks, 32 inodes.
super-block backups (for fsck -b #) at:
32,
Populating `foo.img'
Image `foo.img' complete
$ mkuzip foo.img; echo $?
0
$ ls -lh foo*
-rw-r--r-- 1 paolop devel 624k Dec 4 10:49:24 2013 foo.img
-rwxr-xr-x 1 paolop devel 259k Dec 4 10:49:36 2013 foo.img.uzip*
So, it's ok, I've my uzip file and I mount it :
$ sudo kldload geom_uzip
$ sudo mdconfig -a -t vnode -o readonly -f foo.img.uzip
md0
$ sudo mount -o ro,noatime /dev/md0.uzip /mnt
$ ls -al /mnt/
total 570
drwxr-xr-x 2 1023 1001 512 Dec 4 10:49 .
drwxr-xr-x 6 admin wheel 512 Dec 4 09:23 ..
-rw-r--r-- 1 1023 1001 300001 Dec 4 10:49 bar.txt
-rw-r--r-- 1 1023 1001 262144 Dec 4 10:47 data.img
$ cp /mnt/data.img /tmp/
And panic!
Is there anything I could do to help debugging this problem? I have the
core dump if that helps.
Thanks!
Regards,
--
Paolo Pinto
R&D System Engineer
NETASQ - We secure IT
[-- Attachment #2 --]
0 *H
010 + 0 *H
00
pƱHklX0
*H
010 UFR1
0UNord10UVilleneuve d'Ascq1.0,U
%NETASQ - Secure Internet Connectivity1'0%UNETASQ Certification Authority0
130813144533Z
140813144533Z010 UFR1
0UNord10UVilleneuve d'Ascq1.0,U
%NETASQ - Secure Internet Connectivity1'0%UNETASQ Certification Authority10UPaolo PINTO1%0# *H
paolo.pinto@netasq.com0"0
*H
0
`l[`<=bN hQ.dh"Rq Fm=!]4JD|`KOoeSntoّj$LW<IԍDs.NsryU2KlrhM^c/01hicUq8IB]!" ֍V%1 ;,B,#0"Ug74Au%sK% 00U7DK!LTΘ)0U#0'*D:sj %0 U0 0U0!U0paolo.pinto@netasq.com0 `HB0U%0++0
*H
)ўT$O%:`2&4*Է8Cm]7ރ
0-ho|SM_ܰaqc:`O?*Լk.s
๐FU
F5rVCƅL-zR.dPXV|hv\(0^ArY\93sp|DL3G a%AE_z!;xK
A>100010 UFR1
0UNord10UVilleneuve d'Ascq1.0,U
%NETASQ - Secure Internet Connectivity1'0%UNETASQ Certification Authority
pƱHklX0 + 50 *H
1 *H
0 *H
1
131204125952Z0# *H
1/TIu0l *H
1_0]0 `He*0 `He0
*H
0*H
0
*H
@0+0
*H
(0 +710010 UFR1
0UNord10UVilleneuve d'Ascq1.0,U
%NETASQ - Secure Internet Connectivity1'0%UNETASQ Certification Authority
pƱHklX0*H
1010 UFR1
0UNord10UVilleneuve d'Ascq1.0,U
%NETASQ - Secure Internet Connectivity1'0%UNETASQ Certification Authority
pƱHklX0
*H
bPu1֚_7 /5߸[D˙,ܡ?ÒXڮtOocs{nR@d7ygvf^^xGɳPݡ`\$bEA?ea1
sWϪ=l';{b샎?Y uS~Cc'I /2Y=k>