Subject: kern/14484: Bug in vnode-driver
To: None <>
From: None <>
List: netbsd-bugs
Date: 11/06/2001 14:26:34
>Number:         14484
>Category:       kern
>Synopsis:       cd9660 in vnd reads garbage at the last megabyte
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 06 05:27:00 PST 2001
>Originator:     Michael Kukat
>Release:        NetBSD 1.5.2
System: NetBSD 1.5.2 NetBSD 1.5.2 (calchas) #1: Sun Oct 28 18:08:43 CET 2001 i386

I just created an ISO-image using mkisofs, and wanted to mount it via vnd
to check it and to use it prior having access to my CD writer. While checking
the MD5-sums of the files included, i got a different sum at the possibly last
file in the image. cmp tells a difference in the last megabyte of the file.
Appending a meg of zeroes to the image avoids the problem.

I don't know if it is a problem of cd9660-fs (maybe a read-ahead or so), or the
vnd driver. This should be analyzed further. cmp'ing the image and the vnd raw
device also results in a difference, no matter if i use slive a or c.

This might be a sign for a problem in the vnd driver.

When reading the device, the size also differs.

cd9660 test:

bash-2.05# cd /tmp
bash-2.05# mkdir test
bash-2.05# openssl rand 10000000 >test/testfile
bash-2.05# md5 test/testfile
MD5 (test/testfile) = 1054eabe306569bd82c0f61a072ecbe1
bash-2.05# mkisofs -r -J -o testimg test
Total translation table size: 0
Total rockridge attributes bytes: 249
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used ffa4
4914 extents written (9 Mb)
bash-2.05# vnconfig vnd0 /tmp/testimg
bash-2.05# mount -r -t cd9660 /dev/vnd0a /mnt
bash-2.05# md5 /mnt/testfile
MD5 (/mnt/testfile) = 58fd1ab46c24b447873a380f511f2eb6
bash-2.05# cmp /mnt/testfile test/testfile
/mnt/testfile test/testfile differ: char 9373697, line 36657
bash-2.05# umount /mnt
bash-2.05# vnconfig -u vnd0
bash-2.05# dd if=/dev/zero bs=1024 count=1024 >>/tmp/testimg
1024+0 records in
1024+0 records out
1048576 bytes transferred in 1 secs (1048576 bytes/sec)
bash-2.05# vnconfig vnd0 /tmp/testimg
bash-2.05# mount -r -t cd9660 /dev/vnd0a /mnt
bash-2.05# md5 /mnt/testfile
MD5 (/mnt/testfile) = 1054eabe306569bd82c0f61a072ecbe1
bash-2.05# cmp /mnt/testfile test/testfile 

raw image test:

bash-2.05# md5 /dev/rvnd0c
MD5 (/dev/rvnd0c) = b4dc0166584bc9f27954afe78dfae1fa
bash-2.05# md5 testimg
MD5 (testimg) = c44ea649289273d77fe2d4fd106975e3
bash-2.05# md5 /dev/rvnd0a
MD5 (/dev/rvnd0a) = b4dc0166584bc9f27954afe78dfae1fa
bash-2.05# wc -c /dev/rvnd0a
 10485760 /dev/rvnd0a
bash-2.05# ls -la testimg
-rw-r--r--  1 root  wheel  11112448 Nov  6 14:15 testimg
currently unchecked