Patch "vfio: disable filesystem-dax page pinning" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
vfio: disable filesystem-dax page pinning
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
vfio-disable-filesystem-dax-page-pinning.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
94db151dc89262bfa82922c44e8320cea2334667Mon Sep 17 00:00:00 2001
From: Dan Williams <[email protected]>
Date: Sun, 4 Feb 2018 10:34:02 -0800
Subject: vfio: disable filesystem-dax page pinning
From: Dan Williams <[email protected]>
commit 94db151dc89262bfa82922c44e8320cea2334667 upstream.
Filesystem-DAX is incompatible with 'longterm' page pinning. Without page cache indirection a DAX mapping maps filesystem blocks directly. This means that the filesystem must not modify a file's block map while any page in a mapping is pinned. In order to prevent the situation of userspace holding of filesystem operations indefinitely, disallow 'longterm' Filesystem-DAX mappings.
RDMA has the same conflict and the plan there is to add a 'with lease' mechanism to allow the kernel to notify userspace that the mapping is being torn down for block-map maintenance. Perhaps something similar can be put in place for vfio.
Note that xfs and ext4 still report:
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk"
...at mount time, and resolving the dax-dma-vs-truncate problem is one of the last hurdles to remove that designation.
--- drivers/vfio/vfio_iommu_type1.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/vfio/vfio_iommu_type1.c +15 -3
@@ -338,11 +338,12 @@ static int vaddr_get_pfn(struct mm_struc {struct page *page[1 ];struct vm_area_struct *vma; +struct vm_area_struct *vmas[1 ];int ret;if (mm == current->mm) { - ret =get_user_pages_fast (vaddr,1 , !!(prot &IOMMU_WRITE ), - page); + ret =get_user_pages_longterm (vaddr,1 , !!(prot &IOMMU_WRITE ), + page, vmas); }else {unsigned int flags =0 ;
@@ -351,7 +352,18 @@ static int vaddr_get_pfn(struct mm_strucdown_read (&mm->mmap_sem); ret =get_user_pages_remote (NULL , mm, vaddr,1 , flags, page, -NULL ,NULL ); + vmas,NULL ); +/* +* The lifetime of a vaddr_get_pfn() page pin is +* userspace-controlled. In the fs-dax case this could +* lead to indefinite stalls in filesystem operations. +* Disallow attempts to pin fs-dax pages via this +* interface. +*/ +if (ret >0 &&vma_is_fsdax (vmas[0 ])) { + ret = -EOPNOTSUPP ; +put_page (page[0 ]); + }up_read (&mm->mmap_sem); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/dax-fix-vma_is_fsdax-helper.patch queue-4.14/vfio-disable-filesystem-dax-page-pinning.patch