Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150785009
D28041.id81895.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28041.id81895.diff
View Options
Index: share/man/man7/security.7
===================================================================
--- share/man/man7/security.7
+++ share/man/man7/security.7
@@ -539,7 +539,8 @@
.Va debug.kdb.enter
sysctl.
A panic or trap cannot be forced using the
-.Va debug.kdb.panic
+.Va debug.kdb.panic ,
+.Va debug.kdb.panic_str
and other sysctl's.
.It Ic 2
Highly secure mode \- same as secure mode, plus disks may not be
Index: sys/kern/subr_kdb.c
===================================================================
--- sys/kern/subr_kdb.c
+++ sys/kern/subr_kdb.c
@@ -82,6 +82,7 @@
static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS);
+static int kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS);
@@ -109,6 +110,11 @@
kdb_sysctl_panic, "I",
"set to panic the kernel");
+SYSCTL_PROC(_debug_kdb, OID_AUTO, panic_str,
+ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0,
+ kdb_sysctl_panic_str, "A",
+ "set to panic the kernel");
+
SYSCTL_PROC(_debug_kdb, OID_AUTO, trap,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0,
kdb_sysctl_trap, "I",
@@ -206,6 +212,20 @@
return (0);
}
+static int
+kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+ static char buf[256]; /* static buffer to limit mallocs when panicing */
+
+ *buf = '\0';
+ error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ panic("kdb_sysctl_panic: %s", buf);
+ return (0);
+}
+
static int
kdb_sysctl_trap(SYSCTL_HANDLER_ARGS)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 1:12 AM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30858037
Default Alt Text
D28041.id81895.diff (1 KB)
Attached To
Mode
D28041: sysctl: implement debug.kdb.panic_str
Attached
Detach File
Event Timeline
Log In to Comment