Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zack Rusin" <zack.rusin@broadcom.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v3 12/12] KVM: selftests: Test nested VMware backdoor routing
Date: Wed, 11 Nov 2026 06:21:53 +0000	[thread overview]
Message-ID: <sashiko-outbox-208431@kernel.org> (raw)
In-Reply-To: <60dbf049b84e8d48da4b4c6138e759d8e2cfb92b.1794374897.git.zack.rusin@broadcom.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: selftests: GUEST_ASSERT() at CPL > 0 in l2_guest_code()
  faults with #GP
--

commit 17432eb224b8266c29f7a0e74dd2c96eb87440ef
Author: Zack Rusin <zack.rusin@broadcom.com>

KVM: selftests: Test nested VMware backdoor routing

This commit adds a KVM selftest verifying how nested VMware backdoor port
accesses from L2 are routed between L0 and L1 across VMX and SVM.

> diff --git a/tools/testing/selftests/kvm/x86/vmware_nested_backdoor_test.c b/tools/testing/selftests/kvm/x86/vmware_nested_backdoor_test.c
> new file mode 100644
> index 0000000000000..3d12be7906e0d
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/x86/vmware_nested_backdoor_test.c
> @@ -0,0 +1,223 @@

[ ... ]

> +static void guest_done_handler(struct ex_regs *regs)
> +{
> +	GUEST_DONE();
> +}
> +
> +static void l2_guest_code(void)
> +{
> +	unsigned long rax = guest_case.rax;
> +	unsigned long rbx = 0;
> +	unsigned long rcx = VMPORT_CMD_GETVERSION;
> +	unsigned long rdx = guest_case.rdx;
> +
> +	asm volatile("inl %%dx, %%eax"
> +		     : "+a"(rax), "+b"(rbx), "+c"(rcx), "+d"(rdx));
> +	GUEST_ASSERT(guest_case.expect_l0);
> +	asm volatile("int3");
> +}

[Severity: Medium]
Does GUEST_ASSERT(guest_case.expect_l0) in l2_guest_code() cause a false pass
when a !expect_l0 test case fails to fault on the inl instruction?

l2_guest_code() runs at CPL 2 or CPL 3 with IOPL 0 until int3 transitions to
CPL 0 in guest_done_handler().  If the tested inl does not raise #GP when
guest_case.expect_l0 is false, GUEST_ASSERT() invokes ucall_x86_do_ucall(),
which executes an IN instruction on UCALL_PIO_PORT (0x1000) while still at
CPL > 0.  That port access faults with #GP(0) and exits to L1, where
l1_svm_code() and l1_vmx_code() see GP_VECTOR and report success via
GUEST_DONE() instead of aborting.  Moving the assertion into
guest_done_handler() would run it at CPL 0 where ucalls work.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794374897.git.zack.rusin@broadcom.com?part=12

      reply	other threads:[~2026-11-11  6:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  5:59 [PATCH v3 00/12] KVM: Improve VMware guest support Zack Rusin
2026-11-11  5:59 ` [PATCH v3 01/12] KVM: x86/pmu: Honor enable_vmware_backdoor for VMware pseudo-PMCs Zack Rusin
2026-11-12  0:13   ` Jim Mattson
2026-11-11  5:59 ` [PATCH v3 02/12] KVM: x86: Move VMware backdoor support to separate files Zack Rusin
2026-11-12  0:14   ` Jim Mattson
2026-11-11  5:59 ` [PATCH v3 03/12] KVM: x86: Encapsulate VMware backdoor checks Zack Rusin
2026-11-12  0:14   ` Jim Mattson
2026-11-11  5:59 ` [PATCH v3 04/12] KVM: x86: Add CONFIG_KVM_VMWARE Zack Rusin
2026-11-12  0:15   ` Jim Mattson
2026-11-11  5:59 ` [PATCH v3 05/12] KVM: x86: Add a unified VMware capability Zack Rusin
2026-11-12  0:17   ` Jim Mattson
2026-11-11  5:59 ` [PATCH v3 06/12] KVM: x86: Forward VMware hypercalls to userspace Zack Rusin
2026-11-12  0:28   ` Jim Mattson
2026-11-12  5:48     ` Zack Rusin
2026-11-11  5:59 ` [PATCH v3 07/12] KVM: x86: Route nested VMware backdoors to KVM Zack Rusin
2026-11-11  6:36   ` sashiko-bot
2026-11-11  5:59 ` [PATCH v3 08/12] KVM: selftests: Add helpers to run x86 guest code in user mode Zack Rusin
2026-11-11  5:59 ` [PATCH v3 09/12] KVM: selftests: Port VMware backdoor coverage Zack Rusin
2026-11-11  5:59 ` [PATCH v3 10/12] KVM: selftests: Test VMware hypercall exits Zack Rusin
2026-11-11  6:23   ` sashiko-bot
2026-11-11  6:00 ` [PATCH v3 11/12] KVM: selftests: Test VMware hypercall exits with nested Hyper-V flushes Zack Rusin
2026-11-11  6:00 ` [PATCH v3 12/12] KVM: selftests: Test nested VMware backdoor routing Zack Rusin
2026-11-11  6:21   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-208431@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zack.rusin@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox