]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/reboot: Harden virtualization hooks for emergency reboot
authorSean Christopherson <seanjc@google.com>
Thu, 24 Jul 2025 17:07:23 +0000 (13:07 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:13 +0000 (16:26 +0200)
commit9aa5d870967b3472e410dbbbd682890fdf8ab448
tree9c2283825332ec4363e0442c027b3aedd7c52e59
parentc897531f2e610899e7f95065923e037d3bed778b
x86/reboot: Harden virtualization hooks for emergency reboot

[ Upstream commit 5e408396c60cd0f0b53a43713016b6d6af8d69e0 ]

Provide dedicated helpers to (un)register virt hooks used during an
emergency crash/reboot, and WARN if there is an attempt to overwrite
the registered callback, or an attempt to do an unpaired unregister.

Opportunsitically use rcu_assign_pointer() instead of RCU_INIT_POINTER(),
mainly so that the set/unset paths are more symmetrical, but also because
any performance gains from using RCU_INIT_POINTER() are meaningless for
this code.

Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230721201859.2307736-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Stable-dep-of: a0ee1d5faff1 ("KVM: VMX: Flush shadow VMCS on emergency reboot")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/reboot.h
arch/x86/kernel/reboot.c
arch/x86/kvm/vmx/vmx.c