Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfio-v6.15-rc6' of https://github.com/awilliam/linux-vfio

Pull vfio fix from Alex Williamson:

- Fix an issue in vfio-pci huge_fault handling by aligning faults to
the order, resulting in deterministic use of huge pages. This
avoids a race where simultaneous aligned and unaligned faults to
the same PMD can result in a VM_FAULT_OOM and subsequent VM crash.
(Alex Williamson)

* tag 'vfio-v6.15-rc6' of https://github.com/awilliam/linux-vfio:
vfio/pci: Align huge faults to order

+6 -6
+6 -6
drivers/vfio/pci/vfio_pci_core.c
··· 1646 1646 { 1647 1647 struct vm_area_struct *vma = vmf->vma; 1648 1648 struct vfio_pci_core_device *vdev = vma->vm_private_data; 1649 - unsigned long pfn, pgoff = vmf->pgoff - vma->vm_pgoff; 1649 + unsigned long addr = vmf->address & ~((PAGE_SIZE << order) - 1); 1650 + unsigned long pgoff = (addr - vma->vm_start) >> PAGE_SHIFT; 1651 + unsigned long pfn = vma_to_pfn(vma) + pgoff; 1650 1652 vm_fault_t ret = VM_FAULT_SIGBUS; 1651 1653 1652 - pfn = vma_to_pfn(vma) + pgoff; 1653 - 1654 - if (order && (pfn & ((1 << order) - 1) || 1655 - vmf->address & ((PAGE_SIZE << order) - 1) || 1656 - vmf->address + (PAGE_SIZE << order) > vma->vm_end)) { 1654 + if (order && (addr < vma->vm_start || 1655 + addr + (PAGE_SIZE << order) > vma->vm_end || 1656 + pfn & ((1 << order) - 1))) { 1657 1657 ret = VM_FAULT_FALLBACK; 1658 1658 goto out; 1659 1659 }