diff options
author | Mitchell Horne <mhorne@FreeBSD.org> | 2021-03-23 20:47:14 +0000 |
---|---|---|
committer | Mitchell Horne <mhorne@FreeBSD.org> | 2022-06-27 19:32:06 +0000 |
commit | 758e72c0a8204b10e66c5b106aeba051f819c7dc (patch) | |
tree | be0be5759274e645944835512f3c11a2bd97d0c8 /sys/kern/kern_shutdown.c | |
parent | 6d26e87f48334ae4b30426a8a8bb0ba354d9689e (diff) | |
download | src-758e72c0a8204b10e66c5b106aeba051f819c7dc.tar.gz src-758e72c0a8204b10e66c5b106aeba051f819c7dc.zip |
Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a
file-backed vnode.
Unlike existing disk or network dumpers, the vnode dumper should not be
invoked during a system panic, and therefore is not added to the global
dumper_configs list. Instead, the vnode dumper is constructed ad-hoc
when a live dump is requested using the new ioctl on /dev/mem. This is
similar in spirit to a kgdb session against the live system via
/dev/mem.
As described briefly in the mem(4) man page, live dumps are not
guaranteed to result in a usuable output file, but offer some debugging
value where forcefully panicing a system to dump its memory is not
desirable/feasible.
A future change to savecore(8) will add an option to save a live dump.
Reviewed by: markj, Pau Amma <pauamma@gundo.com> (manpages)
Discussed with: kib
MFC after: 3 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D33813
(cherry picked from commit c9114f9f86f92742eacd1d802c34009a57e81055)
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r-- | sys/kern/kern_shutdown.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 37544e364ee2..0f31622903bf 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -383,6 +383,17 @@ print_uptime(void) printf("%lds\n", (long)ts.tv_sec); } +/* + * Set up a context that can be extracted from the dump. + */ +void +dump_savectx(void) +{ + + savectx(&dumppcb); + dumptid = curthread->td_tid; +} + int doadump(boolean_t textdump) { @@ -395,8 +406,7 @@ doadump(boolean_t textdump) if (TAILQ_EMPTY(&dumper_configs)) return (ENXIO); - savectx(&dumppcb); - dumptid = curthread->td_tid; + dump_savectx(); dumping++; coredump = TRUE; |