Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148799876
D23243.id66939.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
D23243.id66939.diff
View Options
Index: sys/x86/x86/stack_machdep.c
===================================================================
--- sys/x86/x86/stack_machdep.c
+++ sys/x86/x86/stack_machdep.c
@@ -103,15 +103,25 @@
#ifdef STACK
/* Don't consume an NMI that wasn't meant for us. */
- if (nmi_stack == NULL || curthread != nmi_pending)
+ if (nmi_stack == NULL)
return (0);
- if (!TRAPF_USERMODE(tf) && (TF_FLAGS(tf) & PSL_I) != 0)
- stack_capture(curthread, nmi_stack, TF_FP(tf));
- else
- /* We were running in usermode or had interrupts disabled. */
- nmi_stack->depth = 0;
-
+ /*
+ * Pre-set to signify an error condition.
+ */
+ nmi_stack->depth = 0;
+
+ /*
+ * Make sure the current CPU is (still) running the expected thread.
+ */
+ if (curthread == nmi_pending) {
+ /*
+ * We don't grab a backtrace if the thread is in userspace or
+ * interrupts were disabled.
+ */
+ if (!TRAPF_USERMODE(tf) && (TF_FLAGS(tf) & PSL_I) != 0)
+ stack_capture(curthread, nmi_stack, TF_FP(tf));
+ }
atomic_store_rel_ptr((long *)&nmi_pending, (long)NULL);
return (1);
#else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 21, 6:59 AM (8 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30068471
Default Alt Text
D23243.id66939.diff (1 KB)
Attached To
Mode
D23243: x86: fix a race during running thread stack capture resulting in unclaimed NMI
Attached
Detach File
Event Timeline
Log In to Comment