From nobody Thu Jul 21 17:39:10 2022 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 4LpfvL4XB2z4X89N for ; Thu, 21 Jul 2022 17:39:10 +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 4LpfvL3HvKz3Kgk for ; Thu, 21 Jul 2022 17:39:10 +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 4LpfvL2GTQzWLZ for ; Thu, 21 Jul 2022 17:39:10 +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 26LHdAtj004449 for ; Thu, 21 Jul 2022 17:39:10 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 26LHdAEp004448 for bugs@FreeBSD.org; Thu, 21 Jul 2022 17:39:10 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 265362] nmount() "snapshot" without "update" causes a kernel page fault panic Date: Thu, 21 Jul 2022 17:39:10 +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 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658425150; 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=77Wp/ZA9LU0VjdtutK5Ikhhnk00x9suD3Y/IIwIJ/4g=; b=PR38/8jlqgMZ/dnOtMWIwqL3/CJl+x7R2qX5AfpqcA/GlStKx/kxqb1QL2eWjvwJO4E9JI tyMEuKqCFpCG6nUO4nMG91DXDAOmwS5PYIRxwUTtym5/RpbE9Hu3Wt5JJM+JnlpYKHoHp6 Bm0PdzRedah52AusfyJfWS9+AX1Yd11s72waKFYFb1CHWCzam6Yh6+genmJSYMkmj1C8YD z+vu/OT+TtWSka5mf9FsFmsNAWU5TxoZNi5t6pRoalKSnrdru0hw+af2ny2m13fk2ufUEz j1edy9IAgZ87lI/nEYPMT/1YXg3MvRGifTNZlmUlDBtHV2rdmNDmcL2fm/hLww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658425150; a=rsa-sha256; cv=none; b=SZb7KTRi0WCG1w8WtLtszFBmXbFFKI2OckyKm6vnHHcYh1I/hwM7Km5XDih4u3ylzTm8a9 F7Djej3Xu3VtvLoyApDIuLN+GrEVXng8ppNnLJGcy2rDC42uqOMZwLBOlkyjtMnyE7u62p Uwz57CNiAaYMsqC5z1/0xWvsBI2y04njp9JGUS7jFRSW0rd19kpgGdbKR3dpAZdPIrLLFD 3CUMvM4Dsc4ikkIib69fSjIwhVvDbMLX7kPttBoSxVGK7EIq0VNSnO+7OSyC7aJbJedyPl umCsOU5WF5t8S4fhSHtWKRu9Gf1yW6FNiy5xGVFZ7Mk2PXPruI3KeEB0uebv1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265362 Bug ID: 265362 Summary: nmount() "snapshot" without "update" causes a kernel page fault panic 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 ffs_snapshot() assumes that the file system is already mounted, since it dereferences mp->mnt_data (via VFSTOUFS(mp)). That's the case if a snapshot is asked for with the MNT_UPDATE flag. But if a program calls nmount() with "snapshot" but no "update", ffs_snapshot() will be called with a NULL mnt_data. You can see the crash by commenting out the "update" line in mksnap_ffs.c, or by running this as root: #include #include #include #include #include #include #include int main() { struct iovec iov[10]; iov[0].iov_base =3D "fstype"; iov[0].iov_len =3D 7; iov[1].iov_base =3D "ffs"; iov[1].iov_len =3D 4; iov[2].iov_base =3D "fspath"; iov[2].iov_len =3D 7; iov[3].iov_base =3D "/"; iov[3].iov_len =3D 2; iov[4].iov_base =3D "snapshot"; iov[4].iov_len =3D 9; iov[5].iov_base =3D ""; iov[5].iov_len =3D 1; iov[6].iov_base =3D "from"; iov[6].iov_len =3D 5; iov[7].iov_base =3D "x"; iov[7].iov_len =3D 2; nmount(iov, 8, 0); } panic: Fatal page fault at 0xffffffc0004d94f2: 0x00000000000038 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1a4 do_trap_supervisor() at do_trap_supervisor+0x76 cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval =3D 0x38 ffs_snapshot() at ffs_snapshot+0x52 ffs_mount() at ffs_mount+0x372 vfs_domount_first() at vfs_domount_first+0x18c vfs_domount() at vfs_domount+0x208 vfs_donmount() at vfs_donmount+0x742 sys_nmount() at sys_nmount+0x5e syscallenter() at syscallenter+0xec ecall_handler() at ecall_handler+0x18 do_trap_user() at do_trap_user+0xea cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --=20 You are receiving this mail because: You are the assignee for the bug.=