git: 0d4081ed6914 - stable/14 - sys: add conf/std.debug, generic debugging options

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 09 Oct 2024 09:17:34 UTC
The branch stable/14 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d4081ed69147a2591dfc8b89cba42dc6a2ce757

commit 0d4081ed69147a2591dfc8b89cba42dc6a2ce757
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-04-23 21:11:24 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-10-09 08:44:35 +0000

    sys: add conf/std.debug, generic debugging options
    
    The new sys/conf/std.debug contains the list of debugging options
    enabled by default in -CURRENT, so they don't need to be listed
    individually in every kernel config.
    
    Introduce *-DEBUG variants of the major kernel configs.
    
    (cherry picked and modified from commit 4f8f9d708e6a4143f3b178bfab10d0a9b75ba2fe)
    
    Reviewed by:    markj, imp, olce (previous version)
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D46871
---
 sys/amd64/conf/GENERIC-DEBUG       |  9 +++++++++
 sys/amd64/conf/MINIMAL-DEBUG       |  9 +++++++++
 sys/amd64/conf/NOTES               | 11 +++++++++++
 sys/arm/conf/GENERIC-DEBUG         |  9 +++++++++
 sys/arm64/conf/GENERIC-DEBUG       |  9 +++++++++
 sys/conf/std.debug                 | 29 +++++++++++++++++++++++++++++
 sys/i386/conf/GENERIC-DEBUG        |  9 +++++++++
 sys/powerpc/conf/GENERIC-DEBUG     |  9 +++++++++
 sys/powerpc/conf/GENERIC64-DEBUG   |  9 +++++++++
 sys/powerpc/conf/GENERIC64LE-DEBUG |  9 +++++++++
 sys/riscv/conf/GENERIC-DEBUG       |  9 +++++++++
 11 files changed, 121 insertions(+)

diff --git a/sys/amd64/conf/GENERIC-DEBUG b/sys/amd64/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..f7187677370b
--- /dev/null
+++ b/sys/amd64/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/amd64
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG
diff --git a/sys/amd64/conf/MINIMAL-DEBUG b/sys/amd64/conf/MINIMAL-DEBUG
new file mode 100644
index 000000000000..a2533608f8af
--- /dev/null
+++ b/sys/amd64/conf/MINIMAL-DEBUG
@@ -0,0 +1,9 @@
+#
+# MINIMAL-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/amd64
+#
+
+include MINIMAL
+include "std.debug"
+
+ident   MINIMAL-DEBUG
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index c82be3945ac7..db93a47165d6 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -153,3 +153,14 @@ options 	KSTACK_PAGES=5
 # Enable detailed accounting by the PV entry allocator.
 
 options 	PV_STATS
+
+#####################################################################
+# Kernel sanitizers
+
+#options	COVERAGE		# Generic kernel coverage. Used by KCOV
+#options	KCOV			# Kernel Coverage Sanitizer
+# Warning: KUBSAN can result in a kernel too large for loader to load
+#options	KUBSAN			# Kernel Undefined Behavior Sanitizer
+#options	KCSAN			# Kernel Concurrency Sanitizer
+#options	KASAN			# Kernel Address Sanitizer
+#options	KMSAN			# Kernel Memory Sanitizer
diff --git a/sys/arm/conf/GENERIC-DEBUG b/sys/arm/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..f36fe21b1640
--- /dev/null
+++ b/sys/arm/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/ARMv6
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG
diff --git a/sys/arm64/conf/GENERIC-DEBUG b/sys/arm64/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..d954106b58db
--- /dev/null
+++ b/sys/arm64/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/arm64
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG
diff --git a/sys/conf/std.debug b/sys/conf/std.debug
new file mode 100644
index 000000000000..813aa0e4af91
--- /dev/null
+++ b/sys/conf/std.debug
@@ -0,0 +1,29 @@
+#
+# std.debug -- Enable debug options for -CURRENT.
+#
+
+options 	BUF_TRACKING		# Track buffer history
+#options	FULL_BUF_TRACKING	# Track more buffer history
+options 	DDB			# Support DDB.
+options 	FULL_BUF_TRACKING	# Track more buffer history
+options 	GDB			# Support remote GDB.
+options 	DEADLKRES		# Enable the deadlock resolver
+options 	INVARIANTS		# Enable calls of extra sanity checking
+options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
+options 	QUEUE_MACRO_DEBUG_TRASH	# Trash queue(2) internal pointers on invalidation
+options 	WITNESS			# Enable checks to detect deadlocks and cycles
+options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
+options 	MALLOC_DEBUG_MAXZONES=8	# Separate malloc(9) zones
+options 	VERBOSE_SYSINIT=0	# Support debug.verbose_sysinit, off by default
+options		ALT_BREAK_TO_DEBUGGER	# Enter debugger on keyboard escape sequence
+#options	DEBUG_VFS_LOCKS
+
+# Net80211 debugging
+options		IEEE80211_DEBUG
+
+# USB debugging
+options		USB_DEBUG
+options		HID_DEBUG
+
+# CAM debugging
+options		CAMDEBUG
diff --git a/sys/i386/conf/GENERIC-DEBUG b/sys/i386/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..a988096e019e
--- /dev/null
+++ b/sys/i386/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/i386
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG
diff --git a/sys/powerpc/conf/GENERIC-DEBUG b/sys/powerpc/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..6388aaaffb55
--- /dev/null
+++ b/sys/powerpc/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/powerpc
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG
diff --git a/sys/powerpc/conf/GENERIC64-DEBUG b/sys/powerpc/conf/GENERIC64-DEBUG
new file mode 100644
index 000000000000..5e0d43941200
--- /dev/null
+++ b/sys/powerpc/conf/GENERIC64-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/powerpc64
+#
+
+include GENERIC64
+include "std.debug"
+
+ident   GENERIC64-DEBUG
diff --git a/sys/powerpc/conf/GENERIC64LE-DEBUG b/sys/powerpc/conf/GENERIC64LE-DEBUG
new file mode 100644
index 000000000000..97d308864313
--- /dev/null
+++ b/sys/powerpc/conf/GENERIC64LE-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/powerpc64le
+#
+
+include GENERIC64LE
+include "std.debug"
+
+ident   GENERIC64LE-DEBUG
diff --git a/sys/riscv/conf/GENERIC-DEBUG b/sys/riscv/conf/GENERIC-DEBUG
new file mode 100644
index 000000000000..ab16a6cc5cfa
--- /dev/null
+++ b/sys/riscv/conf/GENERIC-DEBUG
@@ -0,0 +1,9 @@
+#
+# GENERIC-DEBUG -- WITNESS and INVARIANTS enabled kernel configuration file
+#			       for FreeBSD/RISC-V
+#
+
+include GENERIC
+include "std.debug"
+
+ident   GENERIC-DEBUG