mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
When running with INVARIANTS, the kernel contains extra checks. However,
these assumptions may not hold true once we've panic'd. Therefore, the checks hold less value after a panic. Additionally, if one of the checks fails while we are already panic'd, this creates a double-panic which can interfere with debugging the original panic. Therefore, this commit allows an administrator to suppress a response to KASSERT checks after a panic by setting a tunable/sysctl. The tunable/sysctl (debug.kassert.suppress_in_panic) defaults to being enabled. Reviewed by: kib Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D12920
This commit is contained in:
parent
611c02b1d2
commit
44b71282b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332860
@ -642,6 +642,7 @@ static int kassert_do_log = 1;
|
||||
static int kassert_log_pps_limit = 4;
|
||||
static int kassert_log_mute_at = 0;
|
||||
static int kassert_log_panic_at = 0;
|
||||
static int kassert_suppress_in_panic = 1;
|
||||
static int kassert_warnings = 0;
|
||||
|
||||
SYSCTL_NODE(_debug, OID_AUTO, kassert, CTLFLAG_RW, NULL, "kassert options");
|
||||
@ -676,6 +677,10 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, log_pps_limit, CTLFLAG_RWTUN,
|
||||
SYSCTL_INT(_debug_kassert, OID_AUTO, log_mute_at, CTLFLAG_RWTUN,
|
||||
&kassert_log_mute_at, 0, "max number of KASSERTS to log");
|
||||
|
||||
SYSCTL_INT(_debug_kassert, OID_AUTO, suppress_in_panic, CTLFLAG_RWTUN,
|
||||
&kassert_suppress_in_panic, 0,
|
||||
"KASSERTs will be suppressed while handling a panic");
|
||||
|
||||
static int kassert_sysctl_kassert(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
SYSCTL_PROC(_debug_kassert, OID_AUTO, kassert,
|
||||
@ -708,6 +713,10 @@ kassert_panic(const char *fmt, ...)
|
||||
static char buf[256];
|
||||
va_list ap;
|
||||
|
||||
/* If we already panic'd, don't create a double-fault. */
|
||||
if (panicstr != NULL && kassert_suppress_in_panic)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
Loading…
Reference in New Issue
Block a user