Page MenuHomeFreeBSD

D23243.id66939.diff
No OneTemporary

D23243.id66939.diff

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

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)

Event Timeline