Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 May 2023 10:44:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271378] negative jt_size in ffs truncate journal record causes fsck to crash
Message-ID:  <bug-271378-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271378

            Bug ID: 271378
           Summary: negative jt_size in ffs truncate journal record causes
                    fsck to crash
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: rtm@lcs.mit.edu

Created attachment 242130
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242130&action=
=3Dedit
gzipped ffs image with bad journal record that causes fsck to crash in
ino_trunc

If a truncate journal record has a negative size, suj.c's ino_trunc()
will index di_db[] with a negative index here:

        lastlbn =3D lblkno(fs, blkroundup(fs, size));
        for (i =3D lastlbn; i < UFS_NDADDR; i++) {
                if ((bn =3D DIP(dp, di_db[i])) =3D=3D 0)

I've attached a gzipped file system image; here's the backtrace
from fsck_ffs -y fsck22a.img:

Program received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
0x000000000022aaca in ino_trunc (ino=3D3, size=3D-4420917493761) at suj.c:1=
329
1329                    if ((bn =3D DIP(dp, di_db[i])) =3D=3D 0)
(gdb) where
#0  0x000000000022aaca in ino_trunc (ino=3D3, size=3D-4420917493761) at suj=
.c:1329
#1  0x00000000002270f7 in cg_trunc (sc=3D0x800a8a8c0) at suj.c:1574
#2  0x0000000000226dc5 in cg_apply (apply=3D0x227090 <cg_trunc>) at suj.c:1=
638
#3  0x0000000000225562 in suj_check (filesys=3D0x7fffffffed74 "junk")
    at suj.c:2460
#4  0x00000000002195c6 in checkfilesys (filesys=3D0x7fffffffed74 "junk")
    at main.c:356
#5  0x0000000000218f72 in main (argc=3D1, argv=3D0x7fffffffea20) at main.c:=
210

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271378-227>