Page MenuHomeFreeBSD

Allow minidumps to be performed on the live system
ClosedPublic

Authored by mhorne on Sep 16 2021, 6:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 22, 7:34 PM
Unknown Object (File)
Sat, Jun 22, 7:27 PM
Unknown Object (File)
Sat, Jun 22, 7:25 PM
Unknown Object (File)
Fri, May 31, 7:44 AM
Unknown Object (File)
Tue, May 28, 9:05 PM
Unknown Object (File)
May 15 2024, 9:54 PM
Unknown Object (File)
Apr 30 2024, 4:55 AM
Unknown Object (File)
Apr 25 2024, 11:13 AM
Subscribers

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
425

Style no longer requires this blank line.