Re: [PATCH v5 0/4] KVM: x86: User-return MSR fix+cleanups

Sean Christopherson
2025-11-10T15:39:00Z

On Thu, 30 Oct 2025 12:15:24 -0700, Sean Christopherson wrote:
> Fix a bug in TDX where KVM will incorrectly update the current user-return
> MSR values when the TDX-Module doesn't actually clobber the relevant MSRs,
> and then cleanup and harden the user-return MSR code, e.g. against forced
> reboots.
>
> v5:
> - Set TDX MSRs to their expected post-run value during
> tdx_prepare_switch_to_guest() instead of trying to predict what value
> is in hardware after the SEAMCALL. [Yan]
> - Free user_return_msrs at kvm_x86_vendor_exit(), not kvm_x86_exit(). [Chao]
>
> [...]

Applied to kvm-x86 misc, thanks!

[1/4] KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module
https://github.com/kvm-x86/linux/commit/c0711f8c610e
[2/4] KVM: x86: WARN if user-return MSR notifier is registered on exit
https://github.com/kvm-x86/linux/commit/b371174d2fa6
[3/4] KVM: x86: Leave user-return notifier registered on reboot/shutdown
https://github.com/kvm-x86/linux/commit/2baa33a8ddd6
[4/4] KVM: x86: Don't disable IRQs when unregistering user-return notifier
https://github.com/kvm-x86/linux/commit/995d504100cf

--