History log of /freebsd-current/sbin/savecore/savecore.8
Revision Date Author Comments
# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# b2c76c41 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line nroff pattern

Remove /^\.\\"\s*\$FreeBSD\$$\n/


# 0a5c04a8 17-Apr-2022 Mitchell Horne <mhorne@FreeBSD.org>

savecore: add an option to save a live minidump

The new '-L' flag will cause savecore to invoke the new mem(4) kernel
dump ioctl, taking a dump of the running system and writing the result
to a temporary file. Validation of the dump header is performed, similar
to regular crash dumps, and the final result is written to
livecore.X[.zst|.gz].

Also added is the '-Z' flag, which instructs the kernel to compress the
livedump compressed with zstd, akin to the existing -z flag. This option
has no effect in normal savecore(8) operation, but in theory could be
extended to perform such compression while reading the dump from the
dump device.

Encryption is unsupported for live dumps.

For example: 'savecore -Lz /var/crash' would create:
/var/crash/livecore.0.gz

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34347


# bc7ed46b 18-Nov-2020 Gleb Smirnoff <glebius@FreeBSD.org>

Add '-u' switch that would uncompress cores that were compressed by
kernel during dump time.

A real life scenario is that cores are compressed to reduce
size of dumpon partition, but we either don't care about space
in the /var/crash or we have a filesystem level compression of
/var/crash. And we want cores to be uncompressed in /var/crash
because we'd like to instantily read them with kgdb. In this
case we want kernel to write cores compressed, but savecore(1)
write them uncompressed.

Reviewed by: markj, gallatin
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27245


# 0457d75c 27-Mar-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Bump .Dd after r331113.

Reported by: oshogbo@
MFC after: 2 weeks


# 7dc5b440 17-Mar-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Xr crashinfo(8) from savecore(8).

MFC after: 2 weeks


# 64a16434 24-Oct-2017 Mark Johnston <markj@FreeBSD.org>

Add support for compressed kernel dumps.

When using a kernel built with the GZIO config option, dumpon -z can be
used to configure gzip compression using the in-kernel copy of zlib.
This is useful on systems with large amounts of RAM, which require a
correspondingly large dump device. Recovery of compressed dumps is also
faster since fewer bytes need to be copied from the dump device.

Because we have no way of knowing the final size of a compressed dump
until it is written, the kernel will always attempt to dump when
compression is configured, regardless of the dump device size. If the
dump is aborted because we run out of space, an error is reported on
the console.

savecore(8) is modified to handle compressed dumps and save them to
vmcore.<index>.gz, as it does when given the -z option.

A new rc.conf variable, dumpon_flags, is added. Its value is added to
the boot-time dumpon(8) invocation that occurs when a dump device is
configured in rc.conf.

Reviewed by: cem (earlier version)
Discussed with: def, rgrimes
Relnotes: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11723


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 480f31c2 10-Dec-2016 Konrad Witaszczyk <def@FreeBSD.org>

Add support for encrypted kernel crash dumps.

Changes include modifications in kernel crash dump routines, dumpon(8) and
savecore(8). A new tool called decryptcore(8) was added.

A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump
configuration in the diocskerneldump_arg structure to the kernel.
The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for
backward ABI compatibility.

dumpon(8) generates an one-time random symmetric key and encrypts it using
an RSA public key in capability mode. Currently only AES-256-CBC is supported
but EKCD was designed to implement support for other algorithms in the future.
The public key is chosen using the -k flag. The dumpon rc(8) script can do this
automatically during startup using the dumppubkey rc.conf(5) variable. Once the
keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O
control.

When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random
IV and sets up the key schedule for the specified algorithm. Each time the
kernel tries to write a crash dump to the dump device, the IV is replaced by
a SHA-256 hash of the previous value. This is intended to make a possible
differential cryptanalysis harder since it is possible to write multiple crash
dumps without reboot by repeating the following commands:
# sysctl debug.kdb.enter=1
db> call doadump(0)
db> continue
# savecore

A kernel dump key consists of an algorithm identifier, an IV and an encrypted
symmetric key. The kernel dump key size is included in a kernel dump header.
The size is an unsigned 32-bit integer and it is aligned to a block size.
The header structure has 512 bytes to match the block size so it was required to
make a panic string 4 bytes shorter to add a new field to the header structure.
If the kernel dump key size in the header is nonzero it is assumed that the
kernel dump key is placed after the first header on the dump device and the core
dump is encrypted.

Separate functions were implemented to write the kernel dump header and the
kernel dump key as they need to be unencrypted. The dump_write function encrypts
data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps
are not supported due to the way they are constructed which makes it impossible
to use the CBC mode for encryption. It should be also noted that textdumps don't
contain sensitive data by design as a user decides what information should be
dumped.

savecore(8) writes the kernel dump key to a key.# file if its size in the header
is nonzero. # is the number of the current core dump.

decryptcore(8) decrypts the core dump using a private RSA key and the kernel
dump key. This is performed by a child process in capability mode.
If the decryption was not successful the parent process removes a partially
decrypted core dump.

Description on how to encrypt crash dumps was added to the decryptcore(8),
dumpon(8), rc.conf(5) and savecore(8) manual pages.

EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU.
The feature still has to be tested on arm and arm64 as it wasn't possible to run
FreeBSD due to the problems with QEMU emulation and lack of hardware.

Designed by: def, pjd
Reviewed by: cem, oshogbo, pjd
Partial review: delphij, emaste, jhb, kib
Approved by: pjd (mentor)
Differential Revision: https://reviews.freebsd.org/D4712


# 06691045 01-Dec-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Add more text to explain --libxo flag.


# eeff0b1b 16-Dec-2012 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Implement -m option to savecore(8) that allows to limit number of kernel
dumps stored. Once the limit is reached it restarts from 0.

Reviewed by: avg
Obtained from: WHEEL Systems


# 349d039b 14-Dec-2012 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- When checking if a dump exists on the given device there is no need to
provide dump directory. Eliminate this redundant argument. This changes
the usage, but the only risk here is that a warning will be printed
about directory given as device.

- Update usage of -C option.

- When clearing dump header from the given device there is also no need to
provide dump directory, although additional arguments for -c were not
documented.

- Document that -v can be used with -c and that list of devices can be given.

Obtained from: WHEEL Systems


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 20ba6b0d 17-Sep-2009 Ruslan Ermilov <ru@FreeBSD.org>

Fixed markup.


# 2a72feb4 23-Apr-2009 Christian Brueffer <brueffer@FreeBSD.org>

Correct the information about when the respective functionality first
appeared in FreeBSD.

PR: 133785
Submitted by: Ulrich Spoerlein <uqs@spoerlein.net>
MFC after: 3 days


# 138f7e4b 24-Dec-2008 Tom Rhodes <trhodes@FreeBSD.org>

Apply various fixes:

Silence mdoc(7) warnings;
Xref correct manual pages;
Point user to the ddb.8 manual page.

PR: 129398
Submitted by: gavin


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 10187cae 26-Dec-2007 Robert Watson <rwatson@FreeBSD.org>

Teach savecore(8) how to extract textdump(4) dumps.

Update savecore(8) man page to reflect textdump additions.

MFC after: 3 months


# 55c82bf0 14-Jun-2005 Ruslan Ermilov <ru@FreeBSD.org>

Markup fixes.

Approved by: re (blanket)


# ff869641 06-Jun-2005 Philip Paeps <philip@FreeBSD.org>

Fix a silly little typo I just spotted.


# 5fb7027c 23-Feb-2005 David E. O'Brien <obrien@FreeBSD.org>

Allow a forced dump even if the dump header information is inconsistent.
Output more verbosity with additional -v's.

Submitted by: seanc


# 6087df9e 18-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sort sections.


# 4c723140 09-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 628d16a3 04-Sep-2003 Doug Barton <dougb@FreeBSD.org>

Add a flag that reports the existence of a dump, and does nothing else.

The immediate purpose for this option is to use it in rc.d so that we
can make savecore behavior conditional.

Tremendous assistance with ideas and sanity checking provided by tjr
and b@etek.chalmers.se.


# ce66ddb7 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/g as discussed on -developers


# 629e80ef 06-Jul-2002 Philippe Charnier <charnier@FreeBSD.org>

The .Nm utility.


# 1fa8142d 29-May-2002 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: nits.


# edc4f96e 04-May-2002 Bill Fenner <fenner@FreeBSD.org>

- revert back to vmcore.#
- reimplement -z
- use syslog()
- improve consistancy of messages
- allow -f to recover cleared dumps
- return bufsize to 1024 * 1024
- return the ability to write sparse files
- update man page
- fix minfree to require 2k for info file instead of the kernel size
- include Berkeley copyright too due to amount of old code copied

Submitted by: Chad David <davidc@acns.ab.ca>


# e2fb2db5 28-Oct-2001 Nick Hibma <n_hibma@FreeBSD.org>

Add a Xref to dumpon.


# e8ae41c3 11-Sep-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: restore the correct sorting of SEE ALSO.


# dff462c3 06-Sep-2001 Kris Kennaway <kris@FreeBSD.org>

* Switch from doing compress(1)ed crashdumps with the -z flag to using
gzip(1). gdb doesn't understand these, but then again it didn't
understand compressed crashdumps either.
* Change a stray lseek() into a Lseek()
* Remove the extraneous prototype for log() which has apparently never
existed in FreeBSD's sources

Obtained from: NetBSD (partially)
MFC after: 2 weeks


# 9fe48c6e 10-Jul-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: removed HISTORY info from the .Os call.


# 4c98f36d 16-Feb-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

Document the new -k option in usage message and man page.


# 896eb7d1 16-Jan-2001 Ruslan Ermilov <ru@FreeBSD.org>

Prepare for mdoc(7)NG.


# 7c7fb079 20-Nov-2000 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: use the new features of the Nm macro.


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# f9b52c93 28-Jul-1998 Philippe Charnier <charnier@FreeBSD.org>

Correct use of .Nm, add rcsid, remove unused #include.


# c0ec1f37 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 4731e263 13-Oct-1996 Bill Fenner <fenner@FreeBSD.org>

Make the savecore command work like the man page says:
- make minfree work by getting the dump size before checking to see
if the dump will fit on the filesystem
- also fail to dump if no minfree is specified but there are not enough
free blocks.

Fix a typo in the man page.

Fixes PR bin/1322

Submitted by: "Philippe C." <charnier@lirmm.fr>


# 4be4929c 23-Sep-1994 Garrett Wollman <wollman@FreeBSD.org>

Get rid of _PATH_UNIX completely; use getbootfile(3) instead.

DANGER WILL ROBINSON!
_PATH_UNIX is currently defined as the literal string "don't use this".
I am of two minds about this myself, but wanted to get something into the
tree as quickly as possible.


# b3bfc719 05-Aug-1994 David Greenman <dg@FreeBSD.org>

Converted 'vmunix' to 'kernel'.


# 8fae3551 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.