Coredump in disklabel with md device

Simon L. Nielsen simon at nitro.dk
Tue May 6 16:33:12 PDT 2003


Hello

While trying to make a patch for docs/51897 and testing it I'm making
bsdlabel/disklabel coredump :

# dd if=/dev/zero of=somebackingfile bs=1k count=10k
# mdconfig -a -t vnode -f somebackingfile -u 0
# disklabel -w md0
# disklabel -e md0

I then add :

  d:    *       0       4.2BSD

and get a floating exception coredump. It seems the memory device
is reporting a sector size of 0 (if I read the code right) :

0x0804ad88 in getasciipartspec (tp=0x0, lp=0xbfbff9d0, part=134540284, lineno=5) at bsdlabel.c:999
999                             if (pp->p_size < 1024*1024*1024 / lp->d_secsize) {
(gdb) bt
#0  0x0804ad88 in getasciipartspec (tp=0x0, lp=0xbfbff9d0, part=134540284, lineno=5) at bsdlabel.c:999
#1  0x0804aa37 in getasciilabel (f=0x2816c6c0, lp=0xbfbff9d0) at bsdlabel.c:879
#2  0x08049f2f in edit () at bsdlabel.c:562
#3  0x0804934a in main (argc=1, argv=0xbfbffb74) at bsdlabel.c:234
#4  0x08049065 in _start ()
(gdb) print lp->d_secsize
$1 = 0

100% reproduceable on :
FreeBSD ford.nitro.dk 5.1-BETA FreeBSD 5.1-BETA #3: Tue May  6 22:49:47 CEST 2003     FreeBSD at trillian.nitro.dk:/usr/obj/data/FreeBSD/clean-CURRENT/sys/GENERIC  i386

If I hack bsdlabel to force 512 byte sectors (like below) everything
seems to work fine (I can newfs and mount the new device).

%%%
Index: bsdlabel.c
===================================================================
RCS file: /data/FreeBSD/ncvs/src/sbin/bsdlabel/bsdlabel.c,v
retrieving revision 1.90
diff -u -r1.90 bsdlabel.c
--- bsdlabel.c	4 May 2003 19:27:22 -0000	1.90
+++ bsdlabel.c	7 May 2003 01:29:13 -0000
@@ -992,6 +992,10 @@
 			pp->p_frag = v / pp->p_fsize;
 			NXTNUM(pp->p_cpg);
 		} else {
+			/* HACK: Check for odd sectorsize e.g. from md devices */
+			if(lp->d_secsize == 0)
+				lp->d_secsize = 512;
+
 			/*
 			 * FIX! poor attempt at adaptive
 			 */
%%%

-- 
Simon L. Nielsen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20030507/e1d45c8e/attachment.bin


More information about the freebsd-current mailing list