summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-09-22 13:24:55 +0900
committerBorislav Petkov (AMD) <bp@alien8.de>2026-09-23 11:28:56 -0700
commitb8d1d5b63a8ef532038eebd9d97d406860385668 (patch)
treef1f3b7ed6fef62ad63aa1ff62961dc9997872c59 /tools/perf/scripts/python
parent6c43c72748fffd29dec15cd1f31e9a32949bc437 (diff)
downloadlinux-b8d1d5b63a8ef532038eebd9d97d406860385668.tar.gz
linux-b8d1d5b63a8ef532038eebd9d97d406860385668.zip
x86/mce: Fix hardware debug register corruption on task migration
In exc_machine_check_user(), local_db_save() and local_db_restore() are invoked in the outer entry stubs (DEFINE_IDTENTRY_MCE_USER, DEFINE_FREDENTRY_MCE, and DEFINE_IDTENTRY_RAW), surrounding exc_machine_check_user(). However, exc_machine_check_user() calls irqentry_exit_to_user_mode(), which handles pending thread work and may schedule() if TIF_NEED_RESCHED is set. If the task migrates to another CPU during schedule(), local_db_restore() runs on the new CPU with the dr7 state saved from the old CPU. This corrupts the new CPU's DR7 hardware debug register and leaves the old CPU's DR7 disabled. In short, local_db_save() and local_db_restore() pair must be run on the same CPU. To fix this, move local_db_save() and local_db_restore() inside exc_machine_check_user() and exc_machine_check_kernel(). In exc_machine_check_user(), DR7 is saved and restored strictly around do_machine_check() to avoid schedule() during migration. In exc_machine_check_kernel(), local_db_save() is called at the entry point to prevent early memory accesses from triggering nested #DB exceptions, and restored on all exits. Fixes: cd840e424f27 ("x86/entry, mce: Disallow #DB during #MC") Assisted-by: LLM Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: <stable@kernel.org> Link: https://patch.msgid.link/179005109564.388919.3937970081044095776.stgit@devnote2
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions