Re: [BUG/RFC] KVM: nVMX: nested_get_vmcs12_pages() kills the VM when the APIC-access page is unbacked, unlike its sibling pointers

From: Sean Christopherson

Date: Fri Oct 16 2026 - 20:54:10 EST


On Sat, Oct 17, 2026, Amirmohammad Eftekhar wrote:
> Hi,
>
> nested_get_vmcs12_pages() (arch/x86/kvm/vmx/nested.c:3448) maps three
> L1-supplied guest-physical pointers into vmcs02 on nested VM-entry. Each is
> VALIDATE-checked for format only (page_address_valid / legal-aligned-gpa),
> never for backing, so a legal-format GPA with no memslot passes every
> consistency check and can only fail at the kvm_vcpu_map() step. When that map
> fails, the three pointers are handled three incompatible ways:
>
> apic_access_addr -> vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR,
> suberror EMULATION, return false. The VM dies
> (every userspace VMM treats INTERNAL_ERROR as fatal).
> virtual_apic_page_addr -> clears CPU_BASED_TPR_SHADOW, or writes INVALID_GPA
> to force a clean VM-entry failure -> L1 gets a
> well-formed VMfail.
> posted_intr_desc_addr -> pi_desc = NULL; clears PIN_BASED_POSTED_INTR and
> runs L2 anyway, with no signal to L1.

...

> Question / suggested direction: should the apic_access arm be made to fail the
> nested entry cleanly (as virtual_apic does), rather than kill the VM?

No. KVM goes out of its way to limp along if the vAPIC or PID pages are bad,
mostly to play nice with tests and pedantic developers. AFAIK, there's no good
option to allow the VM to limp along. If someone has a strong use case *and* a
"fix", they are more than welcome to post it.