On 11/20/26 9:00 AM, Stephen Cheng wrote:
> When L0 handles an event of L2 itself, and L1 intercepts it, L0 creates
> the #VMEXIT to L1. Two parts of that #VMEXIT are wrong:
>
> 1. NextRIP is copied from an earlier hardware #VMEXIT.
> 2. An emulated INT $n is treated as exception n, so the software
> interrupt intercept is not checked. For some n, L1 is crashed with
> "Illegal exitcode".
>
> Patch 1 was sent alone on 22 Oct (no replies); it is only rebased and
> reworded here. v1:
> https://lore.kernel.org/xen-devel/20261022090658.151682-1-stephen.cheng@citrix.com/
>
> Patch 2 is new, and uses the NextRIP from patch 1 for INT $n, so I send
> them together.
>
> Both were found with nested-SVM XTF tests using the forced emulation
> prefix, and tested on AMD EPYC. The VMX part of patch 2 is only build
> tested.
>
> Not fixed here: an ICEBP in L2 which L0 handles (always for a native
> ICEBP, since Xen intercepts it, or when emulated) is checked against the
> #DB intercept instead of the ICEBP intercept (APM 15.12.2). I will send
> a fix separately.
>
> v2:
> - Rebased on current staging.
> - Reworded patch 1's commit message.
> - New patch 2.
>
> Stephen Cheng (2):
> x86/nestedsvm: Record NextRIP with the deferred #VMEXIT
> x86/nestedhvm: Don't treat an emulated INT $n as an exception
>
> xen/arch/x86/hvm/hvm.c | 3 +-
> xen/arch/x86/hvm/svm/nestedhvm.h | 5 +-
> xen/arch/x86/hvm/svm/nestedsvm.c | 60 ++++++++++++++++++++----
> xen/arch/x86/hvm/svm/svm.c | 8 ++--
> xen/arch/x86/hvm/vmx/vmx.c | 6 +--
> xen/arch/x86/hvm/vmx/vvmx.c | 10 +++-
> xen/arch/x86/include/asm/hvm/hvm.h | 8 ++--
> xen/arch/x86/include/asm/hvm/svm-types.h | 1 +
> xen/arch/x86/include/asm/hvm/vmx/vvmx.h | 6 ++-
> 9 files changed, 80 insertions(+), 27 deletions(-)
>
>
> base-commit: 5b28c0efc1d5d73ce651ca651e103c45b6932f9d
This mostly changes VMEXIT handling.
I think the plan is for the rework of VMRUN and VMEXIT to go in first.
Hopefully that resolves several issues but any further bugfixes should be
rebased on top of it and go in afterwards.
Ross