All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 007/119] dax: explain how read(2)/write(2) addresses are validated
@ 2017-09-06 23:18 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-09-06 23:18 UTC (permalink / raw)
  To: akpm, dan.j.williams, hch, jack, mawilcox, mm-commits,
	ross.zwisler, torvalds

From: Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: dax: explain how read(2)/write(2) addresses are validated

Add a comment explaining how the user addresses provided to read(2) and
write(2) are validated in the DAX I/O path.  We call dax_copy_from_iter()
or copy_to_iter() on these without calling access_ok() first in the DAX
code, and there was a concern that the user might be able to read/write to
arbitrary kernel addresses with this path.

Link: http://lkml.kernel.org/r/20170816173615.10098-1-ross.zwisler@linux.intel.com
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/dax.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN fs/dax.c~dax-explain-how-read2-write2-addresses-are-validated fs/dax.c
--- a/fs/dax.c~dax-explain-how-read2-write2-addresses-are-validated
+++ a/fs/dax.c
@@ -1004,6 +1004,11 @@ dax_iomap_actor(struct inode *inode, lof
 		if (map_len > end - pos)
 			map_len = end - pos;
 
+		/*
+		 * The userspace address for the memory copy has already been
+		 * validated via access_ok() in either vfs_read() or
+		 * vfs_write(), depending on which operation we are doing.
+		 */
 		if (iov_iter_rw(iter) == WRITE)
 			map_len = dax_copy_from_iter(dax_dev, pgoff, kaddr,
 					map_len, iter);
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-06 23:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 23:18 [patch 007/119] dax: explain how read(2)/write(2) addresses are validated akpm

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.