diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-05-30 00:27:35 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2020-06-11 16:15:22 +0300 |
commit | cd840e424f27fcc1ae8d14b7ec3ec4560ee6561a (patch) | |
tree | 01ec71e033ea825bc4bccfcb502dce37f5625082 /arch | |
parent | fd338e3564b0b8597a89f83941a0eda3e5092cc0 (diff) | |
download | linux-cd840e424f27fcc1ae8d14b7ec3ec4560ee6561a.tar.xz |
x86/entry, mce: Disallow #DB during #MC
#MC is fragile as heck, don't tempt fate.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200529213321.131187767@infradead.org
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/mce/core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 068e6cab1286..be499267bbb4 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1943,22 +1943,34 @@ static __always_inline void exc_machine_check_user(struct pt_regs *regs) /* MCE hit kernel mode */ DEFINE_IDTENTRY_MCE(exc_machine_check) { + unsigned long dr7; + + dr7 = local_db_save(); exc_machine_check_kernel(regs); + local_db_restore(dr7); } /* The user mode variant. */ DEFINE_IDTENTRY_MCE_USER(exc_machine_check) { + unsigned long dr7; + + dr7 = local_db_save(); exc_machine_check_user(regs); + local_db_restore(dr7); } #else /* 32bit unified entry point */ DEFINE_IDTENTRY_MCE(exc_machine_check) { + unsigned long dr7; + + dr7 = local_db_save(); if (user_mode(regs)) exc_machine_check_user(regs); else exc_machine_check_kernel(regs); + local_db_restore(dr7); } #endif |