From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 2 01:21:40 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADCCE16A4CE for ; Fri, 2 Jul 2004 01:21:40 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D1DF43D41 for ; Fri, 2 Jul 2004 01:21:40 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i621KIMZ032959 for ; Fri, 2 Jul 2004 01:20:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i621KICS032958; Fri, 2 Jul 2004 01:20:18 GMT (envelope-from gnats) Resent-Date: Fri, 2 Jul 2004 01:20:18 GMT Resent-Message-Id: <200407020120.i621KICS032958@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, John Kozubik Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA7C116A4CE for ; Fri, 2 Jul 2004 01:11:28 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id B440543D41 for ; Fri, 2 Jul 2004 01:11:28 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i621Agih037791 for ; Fri, 2 Jul 2004 01:10:42 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i621Ag2H037790; Fri, 2 Jul 2004 01:10:42 GMT (envelope-from nobody) Message-Id: <200407020110.i621Ag2H037790@www.freebsd.org> Date: Fri, 2 Jul 2004 01:10:42 GMT From: John Kozubik To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: misc/68576: UFS2 snapshot files can be mounted read-write and written to X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 01:21:41 -0000 >Number: 68576 >Category: misc >Synopsis: UFS2 snapshot files can be mounted read-write and written to >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 02 01:20:18 GMT 2004 >Closed-Date: >Last-Modified: >Originator: John Kozubik >Release: FreeBSD 5.2.1-RELEASE >Organization: http://www.kozubik.com >Environment: FreeBSD kozubik 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004 root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC i386 >Description: Snapshot files are not to be written to in any circumstance. After mounting the snapshot as per the snapshot documentation, however, one can successfully run `mount -uw` on the mounted snapshot file, thus mounting it read/write. One can then write new files to the snapshot file and alter existing files in it. >How-To-Repeat: mksnap_ffs / /snap1 mkdir /snapmount mdconfig -a -t vnode -f /snap1 -u 4 mount -r /dev/md4 /snapmount So far so good ... now enter the mounted snapshot and attempt to write a file: # cd /snapmount/ # touch test touch: test: Read-only file system # This is the expected behavior. However: # # pwd /snapmount # mount -uw /snapmount # touch test # echo sldkfslk >> /snapmount/test # # cat /snapmount/test sldkfslk # This is unexpected. You can successfully mount the snapshot read/write and create and write to files in that snapshot. You can also write to files that existed in the snapshot prior to mounting it read/write. >Fix: A workaround would be to not mount snapshot files read/write. A more robust workaround would be to add an exception to `mount` that would disallow mounting a snapshot read/write. This would follow the existing trend of writing exceptions into common commands (`rm` for instance) to deal with the special needs of snapshot files. I'm not sure if all these exceptions are a good idea, though, especially if more will be needed as time goes on. >Release-Note: >Audit-Trail: >Unformatted: