lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1416870079-15254-3-git-send-email-pieter@boesman.nl>
Date:	Tue, 25 Nov 2014 00:01:01 +0100
From:	Pieter Smith <pieter@...sman.nl>
To:	pieter@...sman.nl
Cc:	Josh Triplett <josh@...htriplett.org>,
	Alexander Duyck <alexander.h.duyck@...el.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Bertrand Jacquin <beber@...eeweb.net>,
	Catalina Mocanu <catalina.mocanu@...il.com>,
	Daniel Borkmann <dborkman@...hat.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Fabian Frederick <fabf@...net.be>,
	fuse-devel@...ts.sourceforge.net (open list:FUSE: FILESYSTEM...),
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Hugh Dickins <hughd@...gle.com>,
	Iulia Manda <iulia.manda21@...il.com>,
	Jan Beulich <JBeulich@...e.com>,
	"J. Bruce Fields" <bfields@...ldses.org>,
	Jeff Layton <jlayton@...chiereds.net>,
	linux-api@...r.kernel.org (open list:ABI/API),
	linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org (open list),
	linux-nfs@...r.kernel.org (open list:KERNEL NFSD, SUNR...),
	"Luis R. Rodriguez" <mcgrof@...e.com>,
	Matt Turner <mattst88@...il.com>, Mel Gorman <mgorman@...e.de>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Miklos Szeredi <miklos@...redi.hu>,
	netdev@...r.kernel.org (open list:NETWORKING [GENERAL]),
	Oleg Nesterov <oleg@...hat.com>,
	Paul Durrant <Paul.Durrant@...rix.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Peter Foley <pefoley2@...oley.com>,
	Thomas Graf <tgraf@...g.ch>, Tom Herbert <therbert@...gle.com>,
	Trond Myklebust <trond.myklebust@...marydata.com>,
	Willem de Bruijn <willemb@...gle.com>,
	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
	蔡正龙 <zhenglong.cai@...c.com.cn>
Subject: [PATCH v4 2/7] fs: moved kernel_write to fs/read_write

kernel_write shares infrastructure with the read_write translation unit but not
with the splice translation unit. Grouping kernel_write with the read_write
translation unit is more logical. It also paves the way to compiling out the
splice group of syscalls for embedded systems that do not need them.

Signed-off-by: Pieter Smith <pieter@...sman.nl>
---
 fs/read_write.c | 16 ++++++++++++++++
 fs/splice.c     | 16 ----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index d9451ba..f4c8d8b 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1191,3 +1191,19 @@ COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
 }
 #endif
 
+ssize_t kernel_write(struct file *file, const char *buf, size_t count,
+			    loff_t pos)
+{
+	mm_segment_t old_fs;
+	ssize_t res;
+
+	old_fs = get_fs();
+	set_fs(get_ds());
+	/* The cast to a user pointer is valid due to the set_fs() */
+	res = vfs_write(file, (__force const char __user *)buf, count, &pos);
+	set_fs(old_fs);
+
+	return res;
+}
+EXPORT_SYMBOL(kernel_write);
+
diff --git a/fs/splice.c b/fs/splice.c
index c1a2861..44b201b 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -583,22 +583,6 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
 	return res;
 }
 
-ssize_t kernel_write(struct file *file, const char *buf, size_t count,
-			    loff_t pos)
-{
-	mm_segment_t old_fs;
-	ssize_t res;
-
-	old_fs = get_fs();
-	set_fs(get_ds());
-	/* The cast to a user pointer is valid due to the set_fs() */
-	res = vfs_write(file, (__force const char __user *)buf, count, &pos);
-	set_fs(old_fs);
-
-	return res;
-}
-EXPORT_SYMBOL(kernel_write);
-
 ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
 				 struct pipe_inode_info *pipe, size_t len,
 				 unsigned int flags)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ