[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNGGKm0Yzjvn3YVv@google.com>
Date: Mon, 22 Sep 2025 10:23:54 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Tom Lendacky <thomas.lendacky@....com>, Mathias Krause <minipli@...ecurity.net>,
John Allen <john.allen@....com>, Rick Edgecombe <rick.p.edgecombe@...el.com>,
Chao Gao <chao.gao@...el.com>, Xiaoyao Li <xiaoyao.li@...el.com>,
Maxim Levitsky <mlevitsk@...hat.com>, Zhang Yi Z <yi.z.zhang@...ux.intel.com>, Xin Li <xin@...or.com>
Subject: Re: [PATCH v16 19/51] KVM: x86: Don't emulate task switches when IBT
or SHSTK is enabled
On Mon, Sep 22, 2025, Binbin Wu wrote:
>
>
> On 9/20/2025 6:32 AM, Sean Christopherson wrote:
> > Exit to userspace with KVM_INTERNAL_ERROR_EMULATION if the guest triggers
> > task switch emulation with Indirect Branch Tracking or Shadow Stacks
> > enabled,
>
> The code just does it when shadow stack is enabled.
Doh. Fixed that and the EMULATION_FAILED typo Chao pointed out:
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8b31dfcb1de9..06a88a2b08d7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -12194,9 +12194,9 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index,
*/
if (__kvm_emulate_msr_read(vcpu, MSR_IA32_U_CET, &u_cet) ||
__kvm_emulate_msr_read(vcpu, MSR_IA32_S_CET, &s_cet))
- return EMULATION_FAILED;
+ goto unhandled_task_switch;
- if ((u_cet | s_cet) & CET_SHSTK_EN)
+ if ((u_cet | s_cet) & (CET_ENDBR_EN | CET_SHSTK_EN))
goto unhandled_task_switch;
}
Powered by blists - more mailing lists