Re: [PATCH 06/16] KVM: x86: Widen the plane vCPU fd ioctl allowlist
From: David Woodhouse
Date: Wed Nov 18 2026 - 14:10:28 EST
On 18 November 2026 17:58:33 GMT, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>On 11/11/26 23:29, David Woodhouse wrote:
>> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
>>
>> A VMM that puts an initial VTL context on a higher plane cannot finish
>> the job through the plane vCPU's fd. kvm_arch_is_vcpu_plane_ioctl()
>> refuses the ioctls it needs, while the one capability ioctl it does
>> admit, KVM_ENABLE_CAP, reaches *every* vCPU capability handler.
>>
>> - KVM_GET/SET_MP_STATE: a plane vCPU for an AP starts in
>> wait-for-INIT like any non-boot x86 vCPU, and nothing ever sends
>> INIT/SIPI to the higher plane of an AP. The VMM has to mark it
>> runnable itself.
>> - KVM_SET_GUEST_DEBUG: single-step and breakpoints on a non-zero
>> plane. The debug exits surface through the plane-0 KVM_RUN loop
>> like any other plane exit.
>> - KVM_X86_SETUP_MCE: mcg_cap is per vCPU and every twin starts with
>> the KVM_MAX_MCE_BANKS default, so programming plane 0 alone leaves
>> the planes disagreeing. Hyper-V shares MCG state across VTLs.
>> - KVM_ENABLE_CAP: accept only the audited capabilities on a plane fd,
>> the SynIC pair and the two CPUID-enforcement toggles, which change
>> state that each twin keeps separately. Anything else gets -EINVAL, as
>> non-allowlisted ioctls already do. The nested paths behind
>> enlightened VMCS and direct TLB flush have never been audited for
>> plane_level > 0, and without the filter any future vCPU cap would
>> work on planes without anyone having decided that it should.
>
>Not sure about KVM_ENABLE_CAP, the other seem sane.
>
>BTW at some point I'll rewrite these commit messages, they're infuriating...
Yeah. I've grown kind of immune to them now. Even found myself typing "load-bearing" with my actual meat fingers the other day.
I've also been looking harder at the completion thing. We *can't* (well, I don't want to) enter another plane while there's still a completion waiting on the first plane.
Which means any control register or MSR interception which needs to be handed to another plane has to completed first.
I think we need to be able to complete them with the RIP unchanged (not advanced over the instruction). Then for VSM, it's VTL1 which will handle them and then advance RIP for its VTL0. VTL1 wants to be told the instruction length too; I could make QEMU find it but since KVM tends to have it anyway, I'm looking at how I can export that.