rpms/kernel/F-8 linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch, NONE, 1.1 kernel.spec, 1.549, 1.550

Chuck Ebbert cebbert at fedoraproject.org
Fri Oct 10 22:07:19 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-8
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5346

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch 
Log Message:
Don't allow splice to files opened with O_APPEND.

linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch:

--- NEW FILE linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch ---
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Thu, 9 Oct 2008 21:04:54 +0000 (-0700)
Subject: Don't allow splice() to files opened with O_APPEND
X-Git-Tag: v2.6.27~1
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=efc968d450e013049a662d22727cf132618dcb2f

Don't allow splice() to files opened with O_APPEND

This is debatable, but while we're debating it, let's disallow the
combination of splice and an O_APPEND destination.

It's not entirely clear what the semantics of O_APPEND should be, and
POSIX apparently expects pwrite() to ignore O_APPEND, for example.  So
we could make up any semantics we want, including the old ones.

But Miklos convinced me that we should at least give it some thought,
and that accepting writes at arbitrary offsets is wrong at least for
IS_APPEND() files (which always have O_APPEND set, even if the reverse
isn't true: you can obviously have O_APPEND set on a regular file).

So disallow O_APPEND entirely for now.  I doubt anybody cares, and this
way we have one less gray area to worry about.

Reported-and-argued-for-by: Miklos Szeredi <miklos at szeredi.hu>
Acked-by: Jens Axboe <jens.axboe at oracle.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/splice.c b/fs/splice.c
index 1bbc6f4..a1e701c 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -898,6 +898,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 	if (unlikely(!(out->f_mode & FMODE_WRITE)))
 		return -EBADF;
 
+	if (unlikely(out->f_flags & O_APPEND))
+		return -EINVAL;
+
 	ret = rw_verify_area(WRITE, out, ppos, len);
 	if (unlikely(ret < 0))
 		return ret;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.549
retrieving revision 1.550
diff -u -r1.549 -r1.550
--- kernel.spec	10 Oct 2008 09:06:55 -0000	1.549
+++ kernel.spec	10 Oct 2008 22:06:49 -0000	1.550
@@ -631,6 +631,7 @@
 Patch420: linux-2.6-fs-cifs-turn-off-unicode-during-session-establishment.patch
 Patch421: linux-2.6-squashfs.patch
 Patch422: linux-2.6-fs-cifs-fix-plaintext-authentication.patch
+Patch423: linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch
 Patch424: linux-2.6-gfs-locking-exports.patch
 Patch425: linux-2.6-nfs-client-mounts-hang.patch
 
@@ -1130,6 +1131,8 @@
 ApplyPatch linux-2.6-squashfs.patch
 # fix CIFS plaintext passwords
 ApplyPatch linux-2.6-fs-cifs-fix-plaintext-authentication.patch
+# don't allow splice to files opened with O_APPEND
+ApplyPatch linux-2.6-dont-allow-splice-to-files-opened-with-o_append.patch
 # export symbols for gfs2 locking modules
 ApplyPatch linux-2.6-gfs-locking-exports.patch
 # fix nfs mount hang
@@ -1862,6 +1865,9 @@
 
 
 %changelog
+* Fri Oct 10 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.6-40
+- Don't allow splice to files opened with O_APPEND.
+
 * Fri Oct 10 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.6-39
 - Fix buffer overflow in uvcvideo driver.
 




More information about the fedora-extras-commits mailing list