From owner-freebsd-embedded@FreeBSD.ORG Sat Dec 1 22:56:42 2012 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7AA6BC53 for ; Sat, 1 Dec 2012 22:56:42 +0000 (UTC) (envelope-from nick@van-laarhoven.org) Received: from vps.van-laarhoven.org (www.hibma.org [178.21.117.90]) by mx1.freebsd.org (Postfix) with ESMTP id 284928FC08 for ; Sat, 1 Dec 2012 22:56:41 +0000 (UTC) Received: from hitske-wlan.fritz.box (thuis.van-laarhoven.org [80.100.41.4]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by vps.van-laarhoven.org (Postfix) with ESMTPSA id 141315F20C6; Sat, 1 Dec 2012 23:56:55 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: NanoBSD: Create image sparsely From: Nick Hibma In-Reply-To: <20121130010403.GA82618@psconsult.nl> Date: Sat, 1 Dec 2012 23:56:33 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <6BD4F6F8-8D8B-4150-B7A6-C47900C27A06@van-laarhoven.org> References: <42654855-CF29-488A-A645-2A280FC9D074@van-laarhoven.org> <20121130010403.GA82618@psconsult.nl> To: Paul Schenkeveld X-Mailer: Apple Mail (2.1499) Cc: freebsd-embedded@freebsd.org X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 22:56:42 -0000 > When copying sparsely, blocks containing zeroes are not copied over = but > skipped using lseek. When the output file is a newly created regular > file this is OK because sparse blocks read as zeroes. >=20 > But here nanobsd.sh writes to a md(4) device which does not contain > zeroes when created as a swap based device (NANO_MD_BACKING=3Dswap). = When > a file on ${MD}s1 contains a block that deliberately contains zeroes > the resulting copy is not the same as the original which may cause all > kinds of problems. Only when ${MD}s1 is created as a file based = device, > blocks seeked over will read back as zeroes. >=20 > Earlier this month I started a thread on freebsd-security@ related to > this issue (subject: md(4) (swap-base) disks not cleaned on creation) > and the patch by Konstantin Belousov will solve this problem but that > leaves all systems before this patch vulnerable to this problem. Are you referring to the recent commit that bzero's a page when a new = page is created by the pager (instead of an existing one returned)? Well, if my commit follows that commit (making sure that the MFC does = not precede it either) we should be fine. NanoBSD is provided in the = FreeBSD source tree. Nick=