From nobody Tue Oct 12 16:21:48 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B503617F2D74 for ; Tue, 12 Oct 2021 16:21:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HTLXD4KQPz4d4P for ; Tue, 12 Oct 2021 16:21:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B75717A15 for ; Tue, 12 Oct 2021 16:21:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19CGLm0q084044 for ; Tue, 12 Oct 2021 16:21:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19CGLmbT084043 for bugs@FreeBSD.org; Tue, 12 Oct 2021 16:21:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259107] A damaged ext2 superblock can cause a panic due to a recursive bread(). Date: Tue, 12 Oct 2021 16:21:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259107 Bug ID: 259107 Summary: A damaged ext2 superblock can cause a panic due to a recursive bread(). 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 228630 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D228630&action= =3Dedit A damaged ext3 disk image that causes a recursive bread lock attempt. If a damaged ext2 file system has its e2fs_first_dblock superblock field set to zero instead of 1, ext2_compute_sb_data() will attempt to bread() block 1 even though ext2_mount() already has that disk block locked. The panic could be avoided if ext2_compute_sb_data() had another sanity check on e2fs_first_dblock. I've attached a demo disk image: # gunzip ext39.img.gz # mdconfig -f ext39.img # mount -t ext2fs -o ro /dev/md0 /mnt panic: lockmgr_xlock_hard: recursing on non recursive lockmgr 0xfffffe00086efc78 @ /usr/src/sys/kern/vfs_bio.c:3962 panic() at panic+0x43/frame 0xfffffe009bb522c0 lockmgr_xlock_hard() at lockmgr_xlock_hard+0xee/frame 0xfffffe009bb52370 __lockmgr_args() at __lockmgr_args+0x1f9/frame 0xfffffe009bb52410 getblkx() at getblkx+0x195/frame 0xfffffe009bb524d0 breadn_flags() at breadn_flags+0x44/frame 0xfffffe009bb52540 ext2_compute_sb_data() at ext2_compute_sb_data+0x80d/frame 0xfffffe009bb525= d0 ext2_mount() at ext2_mount+0xea9/frame 0xfffffe009bb52770 vfs_domount() at vfs_domount+0x8d8/frame 0xfffffe009bb529e0 vfs_donmount() at vfs_donmount+0x880/frame 0xfffffe009bb52a80 sys_nmount() at sys_nmount+0x69/frame 0xfffffe009bb52ac0 amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe009bb52bf0 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe009bb52bf0 --=20 You are receiving this mail because: You are the assignee for the bug.=