Skip to content

Commit 46c22ff

Browse files
davidhildenbrandborntraeger
authored andcommitted
s390/uv: fully validate the VMA before calling follow_page()
We should not walk/touch page tables outside of VMA boundaries when holding only the mmap sem in read mode. Evil user space can modify the VMA layout just before this function runs and e.g., trigger races with page table removal code since commit dd2283f ("mm: mmap: zap pages with read mmap_sem in munmap"). find_vma() does not check if the address is >= the VMA start address; use vma_lookup() instead. Fixes: 214d9bb ("s390/mm: provide memory management functions for protected KVM guests") Signed-off-by: David Hildenbrand <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Acked-by: Heiko Carstens <[email protected]> Reviewed-by: Liam R. Howlett <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 949f5c1 commit 46c22ff

File tree

1 file changed

+1
-1
lines changed
  • arch/s390/kernel

1 file changed

+1
-1
lines changed

arch/s390/kernel/uv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
212212
uaddr = __gmap_translate(gmap, gaddr);
213213
if (IS_ERR_VALUE(uaddr))
214214
goto out;
215-
vma = find_vma(gmap->mm, uaddr);
215+
vma = vma_lookup(gmap->mm, uaddr);
216216
if (!vma)
217217
goto out;
218218
/*

0 commit comments

Comments
 (0)