Re: [PATCH v2 4/6] kvm: apply VM_READ/VM_WRITE checks to all VMA types

Paolo Bonzini <[email protected]> Tue, 4 Aug 2026 14:44:40 +0200
Newsgroups gmane.comp.emulators.kvm.devel,gmane.comp.video.dri.devel
Message-ID <CABgObfbd63O_UkmCcik1z0J847Sr6a5rnFgwttBjBb0am=+2PQ@mail.gmail.com>
On Tue, Aug 4, 2026 at 2:23=E2=80=AFPM <[email protected]> wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issu=
e(s) to consider:
> - [High] Write faults on write-only `VM_IO | VM_PFNMAP` VMAs are incorrec=
tly rejected, breaking guest writes to write-only device memory.
>
> If a guest performs a memory write to a guest physical address backed by =
a
> write-only host VMA (e.g. VM_IO or VM_PFNMAP mapped with PROT_WRITE but
> without PROT_READ), get_user_pages() will fail and fall back to this look=
up.
>
> Since the write-only VMA lacks VM_READ, this check will evaluate to true =
and
> return KVM_PFN_ERR_FAULT, skipping the VM_IO | VM_PFNMAP handler. Could t=
his
> prevent guests from writing to legitimate write-only device memory, such =
as
> command ring buffers or write-only PCI BARs?

This is theoretical only but actually a bugfix, because KVM does not
support write-only mappings and therefore it would not be possible to
enforce !PROT_READ/PROT_WRITE.

Paolo