From nobody Sun Feb 12 22:05:19 2023 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 4PFM3N2sTHz3pF5w for ; Sun, 12 Feb 2023 22:05:20 +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 4PFM3M5Y9jz4Tc4 for ; Sun, 12 Feb 2023 22:05:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676239519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GhVqc+IGJbVYBvaFxEh9Y6bwx+0s65A19DcotLN9U1Y=; b=s1N4iXfsDDuS6Gjv6cmjojv1SZAgIgXTA5+RNKTfJxvnS8rr9p2pGVPhTf0Y4OKNysw0eb 5uMM+B0Po4c0o4XCARseVWFpM2LWwNDRdNNzwSo3fKptgHf28h090iegsZcFOXtbsOUEzT XFDLoZdyc2iibVJkpSThQE05y3ozRbLvYJNkPDVvE/uFSvA1UybZhWfAuyAYn64BKypFJP 1On3JN2AQ4ZFuC0upEWeLv3Ok+YCk0/ZxJ2w6rXFtYxKkNKd1Eo6OFu1FwwWVGmH7F1L2j 6cehDmktsnNN6qtBwNfkVion9AUDws7mJv/emicvnIgdKLr2eJxgZgLoGtkN5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676239519; a=rsa-sha256; cv=none; b=wMiOTUfpA0HoOX0GthPB2UtW1dK5OSqku+I7QhWu0gYuS28rQ2IYtOqQvGtHtH8ozZ3FLv zNMpotK+1sQpJVPZ9m4CE0lSXemcjmNwKMrGf4Qr5meUfXOSdDexpIn0lwoU320xbTXziD qzOIiLwhcjvJVeDMeRTvE9Qngd+Dt7b+TU19X1GbpfrOLmKDZlMGlL+6ApNZc8zHg7ek6C f0guZeQeZXu5cxJQzyZ8X06BERRUUP2stH0Vp/3PFvCzXjUPPMnHuwjNP01sXHhzBdtrKU U4Qo+OkksdQtQsHN4JIofRJzF8Y8uwDYJbEA/aTBdSiH3GUDJj4zWahXC2kexw== 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 4PFM3M4T68zv6R for ; Sun, 12 Feb 2023 22:05:19 +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 31CM5JuK015781 for ; Sun, 12 Feb 2023 22:05:19 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 31CM5Jix015780 for bugs@FreeBSD.org; Sun, 12 Feb 2023 22:05:19 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 269519] corrupt tar file can cause tarfs file system to panic or crash Date: Sun, 12 Feb 2023 22:05:19 +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 Some People 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=3D269519 Bug ID: 269519 Summary: corrupt tar file can cause tarfs file system to panic or crash Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Created attachment 240118 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D240118&action= =3Dedit broken tar file that causes tarfs to crash I've attached a corrupt tar file with the following content: # tar tvf tarfs10a.tar=20 drwxr-xr-x 0 rtm wheel 0 Feb 11 12:28 ./ ---sr-Sr-T 0 rtm wheel 512 Feb 1 2189 ./d drwxr-xr-x 0 rtm wheel 0 Feb 11 12:28 ./d/ -rw-r--r-- 0 rtm wheel 2 Feb 11 12:28 ./d/b There are two entries for "d"; the first is a file, the second is a directory. When tarfs looks up d/b, this causes the parent tarfs_node passed to tarfs_alloc_node() to refer to a non-VDIR node. When mounted with tarfs on an INVARIANTS kernel, it yields the panic shown below. On a non-INVARIANTS kernel, there's a crash just after line 236 in TAILQ_INSERT_TAIL(&parent->dir.dirhead) because the parent->dir union entry isn't appropriate for a VDIR. # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #41 main-n250948-9475c0be36c7-di= rty: Sun Feb 12 16:10:13 EST 2023=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv #=20 # mount -t tarfs tarfs10a.tar panic: Assertion parent->type =3D=3D VDIR failed at /usr/rtm/symbsd/src/sys/fs/tarfs/tarfs_subr.c:236=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 panic() at panic+0x2a tarfs_alloc_node() at tarfs_alloc_node+0x380 tarfs_alloc_one() at tarfs_alloc_one+0xa9e tarfs_alloc_mount() at tarfs_alloc_mount+0x1a4 tarfs_mount() at tarfs_mount+0x4a2 vfs_domount_first() at vfs_domount_first+0x1ae vfs_domount() at vfs_domount+0x25c vfs_donmount() at vfs_donmount+0x75e sys_nmount() at sys_nmount+0x5e syscallenter() at syscallenter+0xec ecall_handler() at ecall_handler+0x18 do_trap_user() at do_trap_user+0xf6 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --- syscall (378, FreeBSD ELF64, nmount) --=20 You are receiving this mail because: You are the assignee for the bug.=