Bug 124747 - [patch] savecore can't create dump from encrypted swap
Summary: [patch] savecore can't create dump from encrypted swap
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-19 07:50 UTC by Gleb Kurtsou
Modified: 2017-08-30 13:13 UTC (History)
3 users (show)

See Also:


Attachments
file.diff (880 bytes, patch)
2008-06-19 07:50 UTC, Gleb Kurtsou
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gleb Kurtsou freebsd_committer 2008-06-19 07:50:01 UTC
Issue was mentioned recently on stable@
http://docs.freebsd.org/cgi/mid.cgi?47F548D9.8060905

The problem is in order of rc.d scripts.  After encswap finishes it's
impossible to open original (not encrypted) swap device for write so
savecore fails.

Fix: The following patch adds 'encswap' target to be run after 'disks' but
before 'swap1'. With the patch order of scripts becomes:
dumpon
geli
savecore
encswap
swap1

instead of:
dumpon
geli
encswap
swap1
savecore

The problem is that savecore looses ability to log to syslog. You still get
messages on console. The only solution I see is to use some hackery
magic to inject log messages into kern.msgbuf with the help of
/dev/console. I'm not sure it's really needed.

I use this patch since apr 2008. It works for me.



Patch attached with submission follows:
How-To-Repeat: 1. enable swap encryption

/dev/ad0s3b.eli         none            swap    sw              0       0

2. setup dumpdev. in /etc/rc.conf

dumpdev="/dev/ad0s3b"

3. force panic.

4. savecore can't read dump because dumpdev is already open for write.
Comment 1 Mark Linimon freebsd_committer 2008-06-19 22:06:28 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124747 

From misfiled PR conf/125087:

Date: Sun, 29 Jun 2008 02:35:30 +0300
Comment 2 Fabian Keil 2016-03-27 14:03:38 UTC
In ElectroBSD this is solved by letting swapon accept the "late" option:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198598
Comment 3 Fabian Keil 2017-03-31 08:50:33 UTC
swapon accepts the "late" option on all supported branches now so
this PR can probably be closed.
Comment 4 Chris Rees freebsd_committer 2017-08-30 13:13:54 UTC
I agree :)