[Bug 259068] ext2fs can violate some INVARIANTS if file system is damaged

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 11 Oct 2021 12:04:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259068

            Bug ID: 259068
           Summary: ext2fs can violate some INVARIANTS if file system is
                    damaged
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rtm@lcs.mit.edu

Created attachment 228583
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=228583&action=edit
A damaged ext3 disk image that causes INVARIANT failures.

I've attached a damaged ext3 file system that trips
over two INVARIANTS in CURRENT:

  VNASSERT failed: vp->v_type != VNON not true at
/usr/src/sys/kern/vfs_cache.c:2404 (cache_enter_time)

  panic: Assertion dvp != *vpp failed at /usr/src/sys/kern/vfs_cache.c:2084

The first is caused by a directory entry that refers to an
un-allocated inode; ext2_lookup_ino() calls cache_enter()
regardless. The second is caused by a directory entry
with i-number 2 but which is named neither . nor ..; perhaps
ext2_dirbadentry() or ext2_search_dirblock() should filter
these out.

To see a panic on a CURRENT system with INVARIANTS:
# uname -a
FreeBSD stock14 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n248636-d20e9e02db3:
Thu Aug 12 05:47:18 UTC 2021    
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
# gunzip ext36.img.gz 
# mdconfig -f ext36.img 
md0
# mount -t ext2fs -o ro /dev/md0 /mnt
# ls -l /mnt
VNASSERT failed: vp->v_type != VNON not true at
/usr/src/sys/kern/vfs_cache.c:2402 (cache_enter_time)

-- 
You are receiving this mail because:
You are the assignee for the bug.