[PATCH v5 20/38] mm/gup: error out early on !VMA_MAYREAD_BIT VMAs
David Hildenbrand (Arm)
david at kernel.org
Mon Oct 12 11:15:27 PDT 2026
On 10/9/26 20:04, Lorenzo Stoakes (ARM) wrote:
> When populating a VMA range via the aptly named populate_vma_page_range()
> an unreadable VMA will always eventually fail with -EFAULT.
>
> That a VMA is accessible is always checked, however VMA_MAYREAD_BIT is not.
>
> All user mappings always have VMA_MAYREAD_BIT set, so this check only
> impacts kernel mappings.
>
> It is implemented specifically to disallow population of uprobes XOL
> mappings which are exec-only.
>
> A nasty interaction with these mappings may occur if they are mlocked, so
> actively disallow this early.
>
> This allows a subsequent commit to remove the VM_IO check in
> __mm_populate() which otherwise requires non-MMIO mappings to be wrongly
> flagged simply as a workaround.
>
> Acked-by: Zi Yan <ziy at nvidia.com>
> Reviewed-by: Suren Baghdasaryan <surenb at google.com>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> ---
Acked-by: David Hildenbrand (Arm) <david at kernel.org>
--
Cheers,
David
More information about the kvm-riscv
mailing list