IA32_VMX_EPT_VPID_CAP bit 23 reports supervisor shadow-stack control for EPT (EPTP bit 7, EPT entry bit 60). QEMU does not name the bit, so it is dropped from the VMX capabilities of the guest even when KVM supports it for nested guests. Name it "vmx-ept-sss" so that "-cpu host" passes it through, and drop it when the guest has no shadow stacks (cet-ss=off). Windows with Hyper-V/VBS appears to enable CET for its guests only when it is offered MBEC, and with CET it does not boot unless this bit is set. KVM support for supervisor shadow-stack control in nested EPT is posted at https://lore.kernel.org/r/20261204-nested-sss-v1-0-57de06f58b2b@reusswig.codes Signed-off-by: Dennis Reußwig --- This depends on the KVM series linked above, which makes KVM offer the capability to L1; without it the new property stays off. It is meant for the next development cycle, and I am happy to resend once the KVM part is merged. Named CPU models are not changed. The current versions of SapphireRapids, GraniteRapids, SierraForest, ClearwaterForest and DiamondRapids combine vmx-mbec with cet-ss, so they would need new versions with vmx-ept-sss; I can send that as a follow-up once the KVM part is merged. Tested on an Intel Core i7-13700K with the KVM series, on top of QEMU v11.2.0-rc3. "-cpu host" reports vmx-ept-sss=on, "-cpu host,cet-ss=off" reports it off, and Windows 11 with VBS and HVCI boots with MBEC exposed to L1. With QEMU 11.1.4, which drops the bit, the same guest fails to boot on the patched kernel. --- target/i386/cpu.c | 6 +++++- target/i386/cpu.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 40974bee26..ecec5c72d0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1753,7 +1753,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmx-ept-2mb", "vmx-ept-1gb", NULL, NULL, - "vmx-invept", "vmx-eptad", "vmx-ept-advanced-exitinfo", NULL, + "vmx-invept", "vmx-eptad", "vmx-ept-advanced-exitinfo", "vmx-ept-sss", NULL, "vmx-invept-single-context", "vmx-invept-all-context", NULL, NULL, NULL, NULL, NULL, "vmx-invvpid", NULL, NULL, NULL, @@ -2051,6 +2051,10 @@ static FeatureDep feature_dependencies[] = { .from = { FEAT_7_1_EAX, CPUID_7_1_EAX_FRED }, .to = { FEAT_VMX_ENTRY_CTLS, VMX_VM_ENTRY_LOAD_IA32_FRED }, }, + { + .from = { FEAT_7_0_ECX, CPUID_7_0_ECX_CET_SHSTK }, + .to = { FEAT_VMX_EPT_VPID_CAPS, MSR_VMX_EPT_SSS }, + }, }; typedef struct X86RegisterInfo32 { diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 3945e90371..03d8971691 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1374,6 +1374,7 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu, FeatureWord w); #define MSR_VMX_EPT_INVEPT (1ULL << 20) #define MSR_VMX_EPT_AD_BITS (1ULL << 21) #define MSR_VMX_EPT_ADVANCED_VMEXIT_INFO (1ULL << 22) +#define MSR_VMX_EPT_SSS (1ULL << 23) #define MSR_VMX_EPT_INVEPT_SINGLE_CONTEXT (1ULL << 25) #define MSR_VMX_EPT_INVEPT_ALL_CONTEXT (1ULL << 26) #define MSR_VMX_EPT_INVVPID (1ULL << 32) --- base-commit: f210851c088e477e9b79fa906b60c4f15a8bb011 change-id: 20261204-vmx-ept-sss-4e18f9926836 Best regards, -- Dennis Reußwig