Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F97220075
D43569.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
D43569.diff
View Options
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -224,8 +224,7 @@
* Variable panicstr contains argument to first call to panic; used as flag
* to indicate that the kernel has already called panic.
*/
-const char *panicstr;
-bool __read_frequently panicked;
+const char *panicstr __read_mostly;
int __read_mostly dumping; /* system is dumping */
int rebooting; /* system is rebooting */
@@ -899,6 +898,15 @@
int bootopt, newpanic;
static char buf[256];
+ /*
+ * 'fmt' must not be NULL as it is put into 'panicstr' which is then
+ * used as a flag to detect if the kernel has panicked. Also, although
+ * vsnprintf() supports a NULL 'fmt' argument, use a more informative
+ * message.
+ */
+ if (fmt == NULL)
+ fmt = "<no panic string!>";
+
spinlock_enter();
#ifdef SMP
@@ -907,7 +915,7 @@
* concurrently entering panic. Only the winner will proceed
* further.
*/
- if (panicstr == NULL && !kdb_active) {
+ if (!KERNEL_PANICKED() && !kdb_active) {
other_cpus = all_cpus;
CPU_CLR(PCPU_GET(cpuid), &other_cpus);
stop_cpus_hard(other_cpus);
@@ -927,7 +935,6 @@
else {
bootopt |= RB_DUMP;
panicstr = fmt;
- panicked = true;
newpanic = 1;
}
diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h
--- a/sys/sys/kassert.h
+++ b/sys/sys/kassert.h
@@ -35,8 +35,7 @@
#ifdef _KERNEL
extern const char *panicstr; /* panic message */
-extern bool panicked;
-#define KERNEL_PANICKED() __predict_false(panicked)
+#define KERNEL_PANICKED() __predict_false(panicstr != NULL)
/*
* Trap accesses going through a pointer. Moreover if kasan is available trap
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 29, 5:23 AM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13102494
Default Alt Text
D43569.diff (1 KB)
Attached To
Mode
D43569: panic()/KERNEL_PANICKED(): Move back to using 'panicstr' as a flag
Attached
Detach File
Event Timeline
Log In to Comment