From owner-freebsd-arch@FreeBSD.ORG Mon Jan 9 00:03:16 2012 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 907B71065670 for ; Mon, 9 Jan 2012 00:03:16 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id 517418FC0C for ; Mon, 9 Jan 2012 00:03:16 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id q09037wI024742; Sun, 8 Jan 2012 16:03:11 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201201090003.q09037wI024742@gw.catspoiler.org> Date: Sun, 8 Jan 2012 16:03:07 -0800 (PST) From: Don Lewis To: yanegomi@gmail.com In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Cc: arch@FreeBSD.org, delphij@gmail.com Subject: Re: [patch] allow crash dumps to Linux swap partitions X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 00:03:16 -0000 On 8 Jan, Garrett Cooper wrote: > On Sun, Jan 8, 2012 at 3:33 PM, Xin LI wrote: >> On Sun, Jan 8, 2012 at 3:03 PM, Garrett Cooper wrote: >>> On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis wrote: >>>> I've got a machine that is set up to dual boot both FreeBSD and Linux. >>>> It is also disk space impaired, so to make the best use possible of the >>>> available space, I have FreeBSD set up to swap to the Linux swap >>>> partition. Until now I haven't had working crash dumps because geom >>>> didn't permit crash dumps to Linux swap partitions. This patch removes >>>> that limitation.  This could be useful for users of laptops who boot >>>> multiple operating systems. >>> >>>    Seems like a good idea, but could dumping to a Linux partition >>> confuse FreeBSD or vice versa? Even sharing a swap partition could potentially be an issue if the contents of swap for one OS could be interpreted as a crash dump for the other OS. I haven't seen any issues with Linux getting confused about this. Before I made this change, I didn't have a way of testing the reverse. >> Unlikely, these are scratch spaces and validated upon boot (i.e. the >> dump saver would "taste" before saving). And fortunately the dump saver runs in userland, which lessens the possibilities of general mayhem. > So the answer is: > 1. No for FreeBSD > 2. It's unlikely that the Linux side will be affected > ? > I would just be concerned with some potentially more interesting > cases where the swap for a crashdump got partially overwritten, but > the same issue would exist I suppose with FreeBSD if someone whacked > the contents of a partition I suppose, e.g. it's not a big issue if > the tools that grok the crashdump fail gracefully. It's already possible to corrupt the dump image if something consumes a bunch of swap (like fsck checking a big filesystem) before the crash saver runs. Dumping to a raw 386BSD partition has similar issues. In addition to the possibility of accidentally dumping to a partition that contains active filesystems, geom is going to want to taste the partition looking for a BSD label, so it has to be careful about handling random garbage. Also, if the partition formerly contained active filesystems and still has a valid BSD label, the label might not get overwritten, but the crash dump could partially overwrite a filesystem. If at some later date the sysadmin tries to mount that filesystem, the results could be undesirable. It might be a good idea to prevent a 386BSD partition if it contains a valid BSD label with partitions that have an fstype other than "unused". Swap should probably have similar restrictions.