Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dennis Reußwig" <dennis@reusswig.codes>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 10/10] KVM: selftests: Check VMX capabilities for CET in L2 with MBEC
Date: Fri, 04 Dec 2026 00:10:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-248806@kernel.org> (raw)
In-Reply-To: <20261204-nested-sss-v1-10-57de06f58b2b@reusswig.codes>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] kvm: vmx_nested_cet_caps_test fails when host or L0 lacks EPT
  SSS bit 23
- [Low] kvm: vmx_nested_cet_caps_test omits kselftest.h TAP reporting in
  main()
- [Low] kvm: standalone vmx_nested_cet_caps_test instead of extending
  existing test
--

commit 103206ea7ff8c4b0693e6b14fe9e0d35ad3cd5d8
Author: Dennis Reußwig <dennis@reusswig.codes>

KVM: selftests: Check VMX capabilities for CET in L2 with MBEC

This commit adds a new x86 KVM selftest, vmx_nested_cet_caps_test, that
checks whether L1 sees the VMX CET load controls and EPT supervisor
shadow-stack capability when mode-based execute control (MBEC) is
advertised, both with and without the enlightened VMCS.

> diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm
> index 2b502c9ec7cb8..9e62ed2bec1a3 100644
> --- a/tools/testing/selftests/kvm/Makefile.kvm
> +++ b/tools/testing/selftests/kvm/Makefile.kvm
> @@ -148,6 +148,7 @@ TEST_GEN_PROGS_x86 += x86/vmx_invalid_nested_guest_state
>  TEST_GEN_PROGS_x86 += x86/vmx_nested_la57_state_test
>  TEST_GEN_PROGS_x86 += x86/vmx_nested_mbec_test
>  TEST_GEN_PROGS_x86 += x86/vmx_nested_sss_test
> +TEST_GEN_PROGS_x86 += x86/vmx_nested_cet_caps_test
>  TEST_GEN_PROGS_x86 += x86/apic_bus_clock_test
>  TEST_GEN_PROGS_x86 += x86/apic_id_routing_test
>  TEST_GEN_PROGS_x86 += x86/xapic_ipi_test

[Severity: Low]
Could this check be added to an existing test such as vmx_msrs_test.c or
vmx_nested_sss_test.c instead of adding a new standalone binary?  It only
reads four VMX capability MSRs from a minimal guest with and without
eVMCS.

> diff --git a/tools/testing/selftests/kvm/x86/vmx_nested_cet_caps_test.c b/tools/testing/selftests/kvm/x86/vmx_nested_cet_caps_test.c
> new file mode 100644
> index 0000000000000..cb9135df5d133
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/x86/vmx_nested_cet_caps_test.c

[ ... ]

> +	/* Supervisor shadow-stack control needs advanced VM-exit information. */
> +	if (ept_cap & VMX_EPT_VPID_CAP_ADVANCED_VMEXIT_INFO)
> +		__GUEST_ASSERT(ept_cap & VMX_EPT_VPID_CAP_SSS,
> +			       "MBEC offered but supervisor shadow-stack control is not, EPT capabilities 0x%lx",
> +			       ept_cap);

[Severity: Medium]
Can this assertion fail on hosts or nested L1 environments where hardware
or the L0 hypervisor does not expose VMX_EPT_SSS_BIT?

In nested_vmx_setup_secondary_ctls(), KVM masks msrs->ept_caps against the
underlying MSR_IA32_VMX_EPT_VPID_CAP without clearing X86_FEATURE_SHSTK or
SECONDARY_EXEC_MODE_BASED_EPT_EXEC.

On an older L0 hypervisor or VMM that exposes SHSTK, MBEC, and advanced
VM-exit info without EPT SSS, all TEST_REQUIRE() checks in main() pass and
this assertion fails instead of skipping, breaking make run_tests.

[ ... ]

> +	run_test(false);
> +
> +	if (kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS))
> +		run_test(true);
> +	else
> +		pr_info("eVMCS not supported, skipping the eVMCS case\n");
> +
> +	return 0;
> +}

[Severity: Low]
Should main() report results through kselftest.h TAP helpers such as
ksft_print_header(), ksft_set_plan(), ksft_test_result_pass(),
ksft_test_result_skip(), and ksft_finished() instead of pr_info() and a
bare return 0?

Without structured TAP output, test runners cannot distinguish the skipped
eVMCS subcase from a full pass.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-nested-sss-v1-0-57de06f58b2b@reusswig.codes?part=10

  reply	other threads:[~2026-12-04  0:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 23:49 [PATCH 00/10] KVM: nVMX: Supervisor shadow-stack control for nested EPT and CET with eVMCS Dennis Reußwig
2026-12-03 23:49 ` [PATCH 01/10] KVM: nVMX: Allow CET entry/exit controls with enlightened VMCS Dennis Reußwig
2026-12-03 23:49 ` [PATCH 02/10] KVM: x86/mmu: Move TDP A/D tracking type to SPTE bits 56-57 Dennis Reußwig
2026-12-03 23:49 ` [PATCH 03/10] KVM: VMX: Report shadow-stack accesses in EPT violations as PFERR_SS Dennis Reußwig
2026-12-03 23:59   ` sashiko-bot
2026-12-03 23:49 ` [PATCH 04/10] KVM: x86/mmu: Handle the EPT supervisor shadow-stack bit like a write bit Dennis Reußwig
2026-12-04  0:16   ` sashiko-bot
2026-12-04  0:41     ` Dennis Reußwig
2026-12-03 23:49 ` [PATCH 05/10] KVM: nVMX: Shadow supervisor shadow-stack control of nested EPT Dennis Reußwig
2026-12-04  0:17   ` sashiko-bot
2026-12-04  0:41     ` Dennis Reußwig
2026-12-03 23:49 ` [PATCH 06/10] KVM: nVMX: Advertise supervisor shadow-stack control for " Dennis Reußwig
2026-12-04  0:13   ` sashiko-bot
2026-12-04  0:41     ` Dennis Reußwig
2026-12-03 23:49 ` [PATCH 07/10] KVM: selftests: Add helpers for nested EPT shadow-stack and MBEC tests Dennis Reußwig
2026-12-03 23:49 ` [PATCH 08/10] KVM: selftests: Add nested EPT supervisor shadow-stack test Dennis Reußwig
2026-12-04  0:00   ` sashiko-bot
2026-12-03 23:49 ` [PATCH 09/10] KVM: selftests: Add nested EPT mode-based execute control test Dennis Reußwig
2026-12-04  0:07   ` sashiko-bot
2026-12-03 23:49 ` [PATCH 10/10] KVM: selftests: Check VMX capabilities for CET in L2 with MBEC Dennis Reußwig
2026-12-04  0:10   ` sashiko-bot [this message]
2026-12-04  0:41     ` Dennis Reußwig

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-248806@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dennis@reusswig.codes \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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