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)
Tue, Dec 17, 6:08 AM
Unknown Object (File)
Nov 21 2024, 2:33 PM
Unknown Object (File)
Nov 21 2024, 2:33 PM
Unknown Object (File)
Nov 21 2024, 2:33 PM
Unknown Object (File)
Nov 21 2024, 2:32 PM
Unknown Object (File)
Nov 21 2024, 2:12 PM
Unknown Object (File)
Oct 27 2024, 9:00 AM
Unknown Object (File)
Oct 4 2024, 7:05 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.