public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] KVM: Fix race between reboot and hardware enabling
@ 2023-05-12 23:31 Sean Christopherson
  2023-05-12 23:31 ` [PATCH v2 1/2] KVM: Use syscore_ops instead of reboot_notifier to hook restart/shutdown Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Sean Christopherson @ 2023-05-12 23:31 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm, linux-kernel, Marc Zyngier, Oliver Upton, James Morse,
	Suzuki K Poulose, Zenghui Yu, kvmarm, Huacai Chen,
	Aleksandar Markovic, Anup Patel, Atish Patra, kvm-riscv,
	Sean Christopherson

Fix a bug where enabling hardware virtualization can race with a forced
reboot, e.g. `reboot -f`, and result in virt hardware being enabled when
the reboot is attempted, and thus hanging the reboot.

Found by inspection, confirmed by hacking the reboot flow to wait until
KVM loads (the problematic window is ridiculously small).

Fully tested only on x86, compile tested on other architectures.

v2:
 - Rename KVM's callback to kvm_shutdown() to match the hook. [Marc]
 - Don't add a spurious newline. [Marc]

v1: https://lore.kernel.org/all/20230310221414.811690-1-seanjc@google.com

Sean Christopherson (2):
  KVM: Use syscore_ops instead of reboot_notifier to hook
    restart/shutdown
  KVM: Don't enable hardware after a restart/shutdown is initiated

 virt/kvm/kvm_main.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)


base-commit: b3c98052d46948a8d65d2778c7f306ff38366aac
-- 
2.40.1.606.ga4b1b128d6-goog


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-12-13  6:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12 23:31 [PATCH v2 0/2] KVM: Fix race between reboot and hardware enabling Sean Christopherson
2023-05-12 23:31 ` [PATCH v2 1/2] KVM: Use syscore_ops instead of reboot_notifier to hook restart/shutdown Sean Christopherson
2023-12-09  7:26   ` Gowans, James
2023-12-10  4:53     ` Eric W. Biederman
2023-12-11  7:54       ` Gowans, James
2023-12-11 10:27         ` Gowans, James
2023-12-11 23:50           ` Eric W. Biederman
2023-12-12  8:50             ` Gowans, James
2023-12-12 13:38               ` Paolo Bonzini
2023-12-13  6:47               ` Gowans, James
2023-12-11 17:34     ` Sean Christopherson
2023-12-11 17:51       ` Sean Christopherson
2023-12-11 18:47       ` Gowans, James
2023-05-12 23:31 ` [PATCH v2 2/2] KVM: Don't enable hardware after a restart/shutdown is initiated Sean Christopherson
2023-05-18  7:38 ` [PATCH v2 0/2] KVM: Fix race between reboot and hardware enabling Marc Zyngier
2023-05-19 17:41 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox