summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-06-27 10:11:16 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-06-27 10:11:16 +0000
commite0117d5ea117ed542ed57880ff78aacf2d02b7a6 (patch)
tree6b9868286d462aba6e32d1ddd269f3fc7325012c
parent461e4a654b47cac2f78e55d6144de1d9bf4a49b5 (diff)
amd64: MCOUNT_EXIT: restore interrupts, don't unconditionally reenable them
This bug can cause all sorts of problems, but in particular it was most easily reproduced as a double fault in the syscall return path on this CPU model: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz Tons of help from guenther@ in narrowing down the root cause. Fix tweaked by guenther@. Additional input from deraadt@ and kettenis@. ok guenther@
-rw-r--r--sys/arch/amd64/include/profile.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/amd64/include/profile.h b/sys/arch/amd64/include/profile.h
index 7f63b92c8f0..cee88380993 100644
--- a/sys/arch/amd64/include/profile.h
+++ b/sys/arch/amd64/include/profile.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: profile.h,v 1.5 2021/09/04 22:15:33 bluhm Exp $ */
+/* $OpenBSD: profile.h,v 1.6 2023/06/27 10:11:15 cheloha Exp $ */
/* $NetBSD: profile.h,v 1.3 2003/11/28 23:22:45 fvdl Exp $ */
/*
@@ -72,6 +72,6 @@ __asm(" .globl __mcount \n" \
#ifdef _KERNEL
-#define MCOUNT_ENTER (void)&s; __asm__("cli");
-#define MCOUNT_EXIT __asm__("sti");
+#define MCOUNT_ENTER s = intr_disable()
+#define MCOUNT_EXIT intr_restore(s)
#endif /* _KERNEL */