All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL for 4.9 01/54] dax: Avoid page invalidation races and unnecessary radix tree traversals
@ 2017-11-22 22:23 alexander.levin
  2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 04/54] dmaengine: stm32-dma: Set correct args number for DMA request from DT alexander.levin
                   ` (52 more replies)
  0 siblings, 53 replies; 56+ messages in thread
From: alexander.levin @ 2017-11-22 22:23 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jan Kara, Dan Williams, alexander.levin

From: Jan Kara <jack@suse.cz>

[ Upstream commit e3fce68cdbed297d927e993b3ea7b8b1cee545da ]

Currently dax_iomap_rw() takes care of invalidating page tables and
evicting hole pages from the radix tree when write(2) to the file
happens. This invalidation is only necessary when there is some block
allocation resulting from write(2). Furthermore in current place the
invalidation is racy wrt page fault instantiating a hole page just after
we have invalidated it.

So perform the page invalidation inside dax_iomap_actor() where we can
do it only when really necessary and after blocks have been allocated so
nobody will be instantiating new hole pages anymore.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 fs/dax.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index bf6218da7928..800748f10b3d 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1265,6 +1265,17 @@ iomap_dax_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 	if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED))
 		return -EIO;
 
+	/*
+	 * Write can allocate block for an area which has a hole page mapped
+	 * into page tables. We have to tear down these mappings so that data
+	 * written by write(2) is visible in mmap.
+	 */
+	if ((iomap->flags & IOMAP_F_NEW) && inode->i_mapping->nrpages) {
+		invalidate_inode_pages2_range(inode->i_mapping,
+					      pos >> PAGE_SHIFT,
+					      (end - 1) >> PAGE_SHIFT);
+	}
+
 	while (pos < end) {
 		unsigned offset = pos & (PAGE_SIZE - 1);
 		struct blk_dax_ctl dax = { 0 };
@@ -1329,23 +1340,6 @@ iomap_dax_rw(struct kiocb *iocb, struct iov_iter *iter,
 	if (iov_iter_rw(iter) == WRITE)
 		flags |= IOMAP_WRITE;
 
-	/*
-	 * Yes, even DAX files can have page cache attached to them:  A zeroed
-	 * page is inserted into the pagecache when we have to serve a write
-	 * fault on a hole.  It should never be dirtied and can simply be
-	 * dropped from the pagecache once we get real data for the page.
-	 *
-	 * XXX: This is racy against mmap, and there's nothing we can do about
-	 * it. We'll eventually need to shift this down even further so that
-	 * we can check if we allocated blocks over a hole first.
-	 */
-	if (mapping->nrpages) {
-		ret = invalidate_inode_pages2_range(mapping,
-				pos >> PAGE_SHIFT,
-				(pos + iov_iter_count(iter) - 1) >> PAGE_SHIFT);
-		WARN_ON_ONCE(ret);
-	}
-
 	while (iov_iter_count(iter)) {
 		ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
 				iter, iomap_dax_actor);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 56+ messages in thread
* [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long
@ 2017-11-22 22:23 alexander.levin
  2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 10/54] ARM: OMAP2+: Fix WL1283 Bluetooth Baud Rate alexander.levin
  0 siblings, 1 reply; 56+ messages in thread
From: alexander.levin @ 2017-11-22 22:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bob Moore, Lv Zheng, Rafael J . Wysocki, alexander.levin

From: Bob Moore <robert.moore@intel.com>

[ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]

ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e

The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.

Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/acpi/acpica/utresrc.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376da66a..2ad99ea3d496 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
 
 	ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-	/* The absolute minimum resource template is one end_tag descriptor */
-
+	/*
+	 * The absolute minimum resource template is one end_tag descriptor.
+	 * However, we will treat a lone end_tag as just a simple buffer.
+	 */
 	if (aml_length < sizeof(struct aml_resource_end_tag)) {
 		return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
 	}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
 		/* Invoke the user function */
 
 		if (user_function) {
-			status =
-			    user_function(aml, length, offset, resource_index,
-					  context);
+			status = user_function(aml, length, offset,
+					       resource_index, context);
 			if (ACPI_FAILURE(status)) {
 				return_ACPI_STATUS(status);
 			}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
 				*context = aml;
 			}
 
+			/* Check if buffer is defined to be longer than the resource length */
+
+			if (aml_length > (offset + length)) {
+				return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+			}
+
 			/* Normal exit */
 
 			return_ACPI_STATUS(AE_OK);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2017-11-23  6:11 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 22:23 [PATCH AUTOSEL for 4.9 01/54] dax: Avoid page invalidation races and unnecessary radix tree traversals alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 04/54] dmaengine: stm32-dma: Set correct args number for DMA request from DT alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 02/54] net/mlx4_en: Fix type mismatch for 32-bit systems alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 03/54] l2tp: take remote address into account in l2tp_ip and l2tp_ip6 socket lookups alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 06/54] usb: gadget: f_fs: Fix ExtCompat descriptor validation alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 07/54] libcxgb: fix error check for ip6_route_output() alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 08/54] net: systemport: Utilize skb_put_padto() alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 05/54] dmaengine: stm32-dma: Fix null pointer dereference in stm32_dma_tx_status alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 11/54] ARM: OMAP1: DMA: Correct the number of logical channels alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 13/54] be2net: fix accesses to unicast list alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 12/54] vti6: fix device register to report IFLA_INFO_KIND alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 10/54] ARM: OMAP2+: Fix WL1283 Bluetooth Baud Rate alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 09/54] net: systemport: Pad packet before inserting TSB alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 14/54] be2net: fix unicast list filling alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 15/54] net/appletalk: Fix kernel memory disclosure alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 19/54] mac80211: calculate min channel width correctly alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 18/54] mm: fix remote numa hits statistics alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 16/54] libfs: Modify mount_pseudo_xattr to be clear it is not a userspace mount alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 17/54] net: qrtr: Mark 'buf' as little endian alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 21/54] nfs: Don't take a reference on fl->fl_file for LOCK operation alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 20/54] ravb: Remove Rx overflow log messages alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 22/54] drm/exynos/decon5433: update shadow registers iff there are active windows alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 23/54] drm/exynos/decon5433: set STANDALONE_UPDATE_F also if planes are disabled alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 25/54] mac80211: prevent skb/txq mismatch alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 24/54] KVM: arm/arm64: Fix occasional warning from the timer work function alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 27/54] perf/x86/intel: Account interrupts for PEBS errors alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 26/54] NFSv4: Fix client recovery when server reboots multiple times alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 28/54] powerpc/mm: Fix memory hotplug BUG() on radix alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 29/54] qla2xxx: Fix wrong IOCB type assumption alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 31/54] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 30/54] drm/amdgpu: fix bug set incorrect value to vce register alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 35/54] mac80211: don't try to sleep in rate_control_rate_init() alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 32/54] net: sctp: fix array overrun read on sctp_timer_tbl alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 33/54] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 34/54] drm/amdgpu: fix unload driver issue for virtual display alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 36/54] RDMA/qedr: Return success when not changing QP state alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 39/54] tipc: fix cleanup at module unload alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 37/54] RDMA/qedr: Fix RDMA CM loopback alexander.levin
2017-11-23  6:11   ` Amrani, Ram
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 38/54] tipc: fix nametbl_lock soft lockup at module exit alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 42/54] i2c: i2c-cadence: Initialize configuration before probing devices alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 44/54] gtp: clear DF bit on GTP packet tx alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 40/54] dmaengine: pl330: fix double lock alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 43/54] nvmet: cancel fatal error and flush async work before free controller alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 41/54] tcp: correct memory barrier usage in tcp_check_space() alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 47/54] net: thunderx: avoid dereferencing xcv when NULL alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 48/54] be2net: fix initial MAC setting alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 45/54] gtp: fix cross netns recv on gtp socket alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 46/54] net: phy: micrel: KSZ8795 do not set SUPPORTED_[Asym_]Pause alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 49/54] vfio/spapr: Fix missing mutex unlock when creating a window alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 50/54] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 52/54] [media] cec: initiator should be the same as the destination for, poll alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 51/54] xen-netfront: Improve error handling during initialization alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 53/54] xen-netback: vif counters from int/long to u64 alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.9 54/54] net: fec: fix multicast filtering hardware setup alexander.levin
  -- strict thread matches above, loose matches on Subject: below --
2017-11-22 22:23 [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long alexander.levin
2017-11-22 22:23 ` [PATCH AUTOSEL for 4.9 10/54] ARM: OMAP2+: Fix WL1283 Bluetooth Baud Rate alexander.levin

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.