[patch] allow crash dumps to Linux swap partitions

Don Lewis truckman at FreeBSD.org
Mon Jan 9 00:03:16 UTC 2012


On  8 Jan, Garrett Cooper wrote:
> On Sun, Jan 8, 2012 at 3:33 PM, Xin LI <delphij at gmail.com> wrote:
>> On Sun, Jan 8, 2012 at 3:03 PM, Garrett Cooper <yanegomi at gmail.com> wrote:
>>> On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis <truckman at freebsd.org> 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.



More information about the freebsd-arch mailing list