Page MenuHomeFreeBSD

Allow minidumps to be performed on the live system
ClosedPublic

Authored by mhorne on Sep 16 2021, 6:40 PM.

Details

Summary

Add a boolean parameter to minidumpsys(), to indicate a live dump. When
requested, take a snapshot of important global state, and pass this to
the machine-dependent minidump function. For now this includes the
kernel message buffer, and the bitset of pages to be dumped. Beyond
this, we don't take much action to protect the integrity of the dump
from changes in the running system.

A new function msgbuf_duplicate() is added for snapshotting the message
buffer. msgbuf_copy() is insufficient for this purpose since it marks
any new characters it finds as read.

For now, nothing can actually trigger a live minidump. A future patch
will add the mechanism for this.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 41551
Build 38440: arc lint + arc unit

Event Timeline

sys/kern/kern_dump.c
479

The bitset may change even during copying.

I would suggest explaining a bit further why this is ok and in particular try to characterize the inconsistencies that can result.

489

What about a kernel that is configured to dump core and reboot automatically upon a panic? Is kdb_active == 1 in that case? I think not.

sys/kern/kern_dump.c
489

Right, I think what we want is kdb_active || KERNEL_PANICKED().

sys/kern/kern_dump.c
489

IMO it would be reasonable to also/instead assert dumping (and assert !dumping in the live case).

Fix the assertions, first cut at a more detailed block comment.

This revision is now accepted and ready to land.Sep 23 2021, 5:04 PM
markj added inline comments.
sys/kern/subr_msgbuf.c
424

Style no longer requires this blank line.