]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86/mmu: introduce ACC_READ_MASK
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Apr 2026 15:41:58 +0000 (11:41 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 10 May 2026 12:52:55 +0000 (14:52 +0200)
commita8827c19614629ee51f2355ceeea36b96d77eb60
treec0d92aaf54ba28e96bac62bb09ef0c8eaa6707ae
parent949aa12e030eac4424f4832eb93e96c20719ae7b
KVM: x86/mmu: introduce ACC_READ_MASK

Read permissions so far were only needed for EPT, which does not need
ACC_USER_MASK.  Therefore, for EPT page tables ACC_USER_MASK was repurposed
as a read permission bit.

In order to implement nested MBEC, EPT will genuinely have four kinds of
accesses, and there will be no room for such hacks; bite the bullet at
last, enlarging ACC_ALL to four bits and permissions[] to 2^4 bits (u16).

The new code does not enforce that the XWR bits on non-execonly processors
have their R bit set, even when running nested: none of the shadow_*_mask
values have bit 0 set, and make_spte() genuinely relies on ACC_READ_MASK
being requested!  This works because, if execonly is not supported by the
processor, shadow EPT will generate an EPT misconfig vmexit if the XWR
bits represent a non-readable page, and therefore the pte_access argument
to make_spte() will also always have ACC_READ_MASK set.

Tested-by: David Riley <d.riley@proxmox.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/mmutrace.h
arch/x86/kvm/mmu/paging_tmpl.h
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h
arch/x86/kvm/vmx/capabilities.h
arch/x86/kvm/vmx/common.h
arch/x86/kvm/vmx/vmx.c