bin/188762: makefs(8) create bad images with UFS2. 100% reproducibility.

Oleg Ginzburg olevole at olevole.ru
Fri Apr 18 14:40:02 UTC 2014


>Number:         188762
>Category:       bin
>Synopsis:       makefs(8) create bad images with UFS2. 100% reproducibility.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 18 14:40:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Oleg Ginzburg
>Release:        FreeBSD 11
>Organization:
>Environment:
FreeBSD home.my.domain 11.0-CURRENT FreeBSD 11.0-CURRENT #2 r264340M: Fri Apr 11 12:01:21 UTC 2014     root at home.my.domain:/usr/jails/src/obj_amd64_amd64_11/usr/src/sys/GENERIC.CBSD  amd64
>Description:
makefs(8) create bad images with UFS2. 100% reproducibility.
>How-To-Repeat:
1) Populate some data, for example - base of FreeBSD. On the small size of data problem is not reproducible. 

% bsdinstall jail /tmp/base

2) Create image with UFS2 (on UFS1 is not reproducible) by makefs:

% makefs -o version=2 /tmp/base.img /tmp/base

3) Attach via mdconfig
% mdconfig -a -t vnode -f /tmp/base.img 
md0


4) First run fsck (FS is not consistent, why?):
% fsck_ufs -y /dev/md0  
** /dev/md0
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
UNALLOCATED  I=1536  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/uk_UA.ISO8859-5/tcsh.cat

REMOVE? yes

UNALLOCATED  I=1537  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/zh_CN.UTF-8/grep.cat

REMOVE? yes

UNALLOCATED  I=1535  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/POSIX

REMOVE? yes

UNALLOCATED  I=2106  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_COLLATE

REMOVE? yes

UNALLOCATED  I=2107  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_MONETARY

REMOVE? yes

UNALLOCATED  I=2108  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_CTYPE

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

13074 files, 307370 used, 18677 free (125 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

5) Second fsck, all clean:
% fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
13074 files, 307370 used, 18677 free (125 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED CLEAN *****


6) Mount and unmount fs (when mount with -oro, problem is not reproducible):
% mount /dev/md0 /mnt
% umount /mnt

7)  Third run of fsck, FS is not consistent) :
fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
PARTIALLY ALLOCATED INODE I=128
CLEAR? yes

PARTIALLY ALLOCATED INODE I=132
CLEAR? yes

** Phase 2 - Check Pathnames
UNALLOCATED  I=128  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-15

REMOVE? yes

UNALLOCATED  I=129  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-1

REMOVE? yes

UNALLOCATED  I=132  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/nls/en_US.US-ASCII

REMOVE? yes

UNALLOCATED  I=133  OWNER=root MODE=0
SIZE=0 MTIME=Mar 16 16:58 2242 
NAME=/var/db/etcupdate/current/usr/share/nls/POSIX

REMOVE? yes

UNALLOCATED  I=134  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/man/en.UTF-8

REMOVE? yes

UNALLOCATED  I=135  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/man/en.ISO8859-15

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=126  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 15 01:03 2014  COUNT 4 SHOULD BE 3
ADJUST? yes

LINK COUNT DIR I=127  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 15 01:03 2014  COUNT 3 SHOULD BE 2
ADJUST? yes

UNREF FILE  I=137  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

NO lost+found DIRECTORY
CREATE? yes

UNREF FILE  I=138  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=139  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=140  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=141  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=142  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=143  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=144  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=145  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

13067 files, 307369 used, 18678 free (126 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

8) And again:
root at home:/ # fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
PARTIALLY ALLOCATED INODE I=128
CLEAR? yes

PARTIALLY ALLOCATED INODE I=132
CLEAR? yes

** Phase 2 - Check Pathnames
UNALLOCATED  I=128  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/lost+found

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=2  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 18 17:58 2014  COUNT 18 SHOULD BE 17
ADJUST? yes

UNREF FILE  I=137  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

NO lost+found DIRECTORY
CREATE? yes

UNREF FILE  I=138  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=139  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=140  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=141  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=142  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=143  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=144  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=145  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

** Phase 5 - Check Cyl groups
SUMMARY INFORMATION BAD
SALVAGE? yes

13067 files, 307369 used, 18678 free (126 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM STILL DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

9) And again:
fsck_ufs -y /dev/md0
** /dev/md0
Cannot find file system superblock
ioctl (GCINFO): Inappropriate ioctl for device
fsck_ufs: /dev/md0: can't read disk label


10) No superblock, no data
% mount -oro /dev/md0 /mnt
% mount: /dev/md0: Invalid argument

>Fix:
sorry

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list