All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	Michal Hocko <mhocko@suse.com>,
	kvm@vger.kernel.org, Haozhong Zhang <haozhong.zhang@intel.com>,
	Christoph Hellwig <hch@lst.de>,
	Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH 4.14 027/110] vfio: disable filesystem-dax page pinning
Date: Wed,  7 Mar 2018 11:38:10 -0800	[thread overview]
Message-ID: <20180307191043.187618642@linuxfoundation.org> (raw)
In-Reply-To: <20180307191039.748351103@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Williams <dan.j.williams@intel.com>

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.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: kvm@vger.kernel.org
Cc: <stable@vger.kernel.org>
Reported-by: Haozhong Zhang <haozhong.zhang@intel.com>
Tested-by: Haozhong Zhang <haozhong.zhang@intel.com>
Fixes: d475c6346a38 ("dax,ext2: replace XIP read and write with DAX I/O")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/vfio/vfio_iommu_type1.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -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_struc
 
 		down_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);
 	}
 

  parent reply	other threads:[~2018-03-07 19:38 UTC|newest]

Thread overview: 131+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 19:37 [PATCH 4.14 000/110] 4.14.25-stable review Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 001/110] Bluetooth: btusb: Use DMI matching for QCA reset_resume quirking Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 002/110] ixgbe: fix crash in build_skb Rx code path Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 003/110] tpm: st33zp24: fix potential buffer overruns caused by bit glitches on the bus Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 004/110] tpm: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 005/110] tpm_i2c_infineon: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 006/110] tpm_i2c_nuvoton: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 007/110] tpm_tis: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 008/110] tpm: constify transmit data pointers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 009/110] tpm_tis_spi: Use DMA-safe memory for SPI transfers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 010/110] ALSA: usb-audio: Add a quirck for B&W PX headphones Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 011/110] ALSA: control: Fix memory corruption risk in snd_ctl_elem_read Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 012/110] ALSA: x86: Fix missing spinlock and mutex initializations Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 013/110] ALSA: hda: Add a power_save blacklist Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 014/110] ALSA: hda - Fix pincfg at resume on Lenovo T470 dock Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 015/110] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 016/110] mmc: dw_mmc-k3: Fix out-of-bounds access through DT alias Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 017/110] mmc: dw_mmc: Avoid accessing registers in runtime suspended state Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 018/110] mmc: dw_mmc: Factor out dw_mci_init_slot_caps Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 019/110] mmc: dw_mmc: Fix out-of-bounds access for slots caps Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 020/110] timers: Forward timer base before migrating timers Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 021/110] parisc: Use cr16 interval timers unconditionally on qemu Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 022/110] parisc: Reduce irq overhead when run in qemu Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 023/110] parisc: Fix ordering of cache and TLB flushes Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 024/110] btrfs: use proper endianness accessors for super_copy Greg Kroah-Hartman
2018-03-15 18:55   ` Christoph Biedl
2018-03-16 12:30     ` Greg Kroah-Hartman
2018-03-16 13:22       ` David Sterba
2018-03-16 14:02         ` Greg Kroah-Hartman
2018-03-16 16:21           ` Anand Jain
2018-03-17 17:27       ` Christoph Biedl
2018-03-19 19:32         ` David Sterba
2018-03-20  9:32           ` Anand Jain
2018-03-16 16:21     ` Anand Jain
2018-03-07 19:38 ` [PATCH 4.14 025/110] block: fix the count of PGPGOUT for WRITE_SAME Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 026/110] block: kyber: fix domain token leak during requeue Greg Kroah-Hartman
2018-03-07 19:38 ` Greg Kroah-Hartman [this message]
2018-03-07 19:38 ` [PATCH 4.14 028/110] cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 029/110] dax: fix vma_is_fsdax() helper Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 030/110] direct-io: Fix sleep in atomic due to sync AIO Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 031/110] x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend Greg Kroah-Hartman
2018-03-07 19:38   ` Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 032/110] x86/platform/intel-mid: Handle Intel Edison reboot correctly Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 033/110] x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 034/110] bridge: check brport attr show in brport_show Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 035/110] fib_semantics: Dont match route with mismatching tclassid Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 036/110] hdlc_ppp: carrier detect ok, dont turn off negotiation Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 037/110] ipv6 sit: work around bogus gcc-8 -Wrestrict warning Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 038/110] net: amd-xgbe: fix comparison to bitshift when dealing with a mask Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 039/110] net: ethernet: ti: cpsw: fix net watchdog timeout Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 040/110] net: fix race on decreasing number of TX queues Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 041/110] net: ipv4: dont allow setting net.ipv4.route.min_pmtu below 68 Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 042/110] netlink: ensure to loop over all netns in genlmsg_multicast_allns() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 043/110] net: sched: report if filter is too large to dump Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 044/110] ppp: prevent unregistered channels from connecting to PPP units Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 045/110] sctp: verify size of a new chunk in _sctp_make_chunk() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 046/110] udplite: fix partial checksum initialization Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 047/110] net/mlx5e: Fix TCP checksum in LRO buffers Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 048/110] sctp: fix dst refcnt leak in sctp_v4_get_dst Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 049/110] mlxsw: spectrum_switchdev: Check success of FDB add operation Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 050/110] net/mlx5e: Specify numa node when allocating drop rq Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 051/110] net: phy: fix phy_start to consider PHY_IGNORE_INTERRUPT Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 052/110] tcp: Honor the eor bit in tcp_mtu_probe Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 053/110] rxrpc: Fix send in rxrpc_send_data_packet() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 054/110] tcp_bbr: better deal with suboptimal GSO Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 055/110] doc: Change the min default value of tcp_wmem/tcp_rmem Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 056/110] net/mlx5e: Fix loopback self test when GRO is off Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 057/110] net_sched: gen_estimator: fix broken estimators based on percpu stats Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 058/110] net/sched: cls_u32: fix cls_u32 on filter replace Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 059/110] sctp: do not pr_err for the duplicated node in transport rhlist Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 060/110] tcp: revert F-RTO middle-box workaround Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 061/110] tcp: revert F-RTO extension to detect more spurious timeouts Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 062/110] mlxsw: spectrum_router: Fix error path in mlxsw_sp_vr_create Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 063/110] net: ipv4: Set addr_type in hash_keys for forwarded case Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 064/110] sctp: fix dst refcnt leak in sctp_v6_get_dst() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 065/110] bridge: Fix VLAN reference count problem Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 066/110] net/mlx5e: Verify inline header size do not exceed SKB linear size Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 067/110] amd-xgbe: Restore PCI interrupt enablement setting on resume Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 068/110] cls_u32: fix use after free in u32_destroy_key() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 069/110] mlxsw: spectrum_router: Do not unconditionally clear route offload indication Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 070/110] netlink: put module reference if dump start fails Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 071/110] tcp: purge write queue upon RST Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 072/110] tuntap: correctly add the missing XDP flush Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 073/110] tuntap: disable preemption during XDP processing Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 074/110] virtio-net: disable NAPI only when enabled during XDP set Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 075/110] s390/qeth: fix underestimated count of buffer elements Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 076/110] s390/qeth: fix SETIP command handling Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 077/110] s390/qeth: fix overestimated count of buffer elements Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 078/110] s390/qeth: fix IP removal on offline cards Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 079/110] s390/qeth: fix double-free on IP add/remove race Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 080/110] Revert "s390/qeth: fix using of ref counter for rxip addresses" Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 081/110] s390/qeth: fix IP address lookup for L3 devices Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 082/110] s390/qeth: fix IPA command submission race Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 083/110] blk-mq: dont call io scheds .requeue_request when requeueing rq to ->dispatch Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 084/110] media: m88ds3103: dont call a non-initalized function Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 085/110] EDAC, sb_edac: Fix out of bound writes during DIMM configuration on KNL Greg Kroah-Hartman
2018-03-07 19:39   ` [4.14,085/110] " Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 086/110] KVM: s390: take care of clock-comparator sign control Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 087/110] KVM: s390: provide only a single function for setting the tod (fix SCK) Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 088/110] KVM: s390: consider epoch index on hotplugged CPUs Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 089/110] KVM: s390: consider epoch index on TOD clock syncs Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 090/110] nospec: Allow index argument to have const-qualified type Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 091/110] x86/mm: Fix {pmd,pud}_{set,clear}_flags() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 092/110] ARM: orion: fix orion_ge00_switch_board_info initialization Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 093/110] ARM: dts: rockchip: Remove 1.8 GHz operation point from phycore som Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 094/110] ARM: mvebu: Fix broken PL310_ERRATA_753970 selects Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 095/110] ARM: kvm: fix building with gcc-8 Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 096/110] KVM: x86: extend usage of RET_MMIO_PF_* constants Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 097/110] KVM: X86: Fix SMRAM accessing even if VM is shutdown Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 098/110] KVM: mmu: Fix overlap between public and private memslots Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 099/110] KVM/x86: Remove indirect MSR op calls from SPEC_CTRL Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 100/110] KVM: x86: move LAPIC initialization after VMCS creation Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 101/110] KVM/VMX: Optimize vmx_vcpu_run() and svm_vcpu_run() by marking the RDMSR path as unlikely() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 102/110] KVM: x86: fix vcpu initialization with userspace lapic Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 103/110] PCI/ASPM: Deal with missing root ports in link state handling Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 104/110] KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 105/110] KVM/x86: remove WARN_ON() for when vm_munmap() fails Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 106/110] ACPI / bus: Parse tables as term_list for Dell XPS 9570 and Precision M5530 Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 107/110] ARM: dts: LogicPD SOM-LV: Fix I2C1 pinmux Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 108/110] ARM: dts: LogicPD Torpedo: " Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 109/110] md: only allow remove_and_add_spares when no sync_thread running Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 110/110] nvme-rdma: dont suppress send completions Greg Kroah-Hartman
2018-03-07 23:57 ` [PATCH 4.14 000/110] 4.14.25-stable review Shuah Khan
2018-03-08  4:19 ` kernelci.org bot
2018-03-09  0:05   ` Kevin Hilman
2018-03-09  1:09     ` Greg Kroah-Hartman
2018-03-09  8:02     ` Quentin Schulz
2018-03-09 17:49       ` Kevin Hilman
2018-03-08  8:36 ` Naresh Kamboju
2018-03-08 12:00   ` Naresh Kamboju
2018-03-08 14:22 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180307191043.187618642@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=haozhong.zhang@intel.com \
    --cc=hch@lst.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.