]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.27 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 3 Mar 2009 01:37:44 +0000 (17:37 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 3 Mar 2009 01:37:44 +0000 (17:37 -0800)
queue-2.6.27/documnt-fmode_-constants.patch [new file with mode: 0644]
queue-2.6.27/seq_file-properly-cope-with-pread.patch [new file with mode: 0644]
queue-2.6.27/series
queue-2.6.27/vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags.patch [new file with mode: 0644]
queue-2.6.27/vt-declare-pio_cmap-gio_cmap-as-compatbile-ioctls.patch [new file with mode: 0644]

diff --git a/queue-2.6.27/documnt-fmode_-constants.patch b/queue-2.6.27/documnt-fmode_-constants.patch
new file mode 100644 (file)
index 0000000..4f8cab4
--- /dev/null
@@ -0,0 +1,55 @@
+From fc9161e54d0dbf799beff9692ea1cc6237162b85 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Wed, 5 Nov 2008 14:58:46 +0100
+Subject: documnt FMODE_ constants
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit fc9161e54d0dbf799beff9692ea1cc6237162b85 upstream.
+
+Make sure all FMODE_ constants are documents, and ensure a coherent
+style for the already existing comments.
+
+[This is needed for the next patch in the .27 kernel which
+ changes fs.h.  This patch makes it easier to handle. - gkh]
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/fs.h |   23 +++++++++++------------
+ 1 file changed, 11 insertions(+), 12 deletions(-)
+
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -63,18 +63,17 @@ extern int dir_notify_enable;
+ #define MAY_ACCESS 16
+ #define MAY_OPEN 32
+-#define FMODE_READ 1
+-#define FMODE_WRITE 2
+-
+-/* Internal kernel extensions */
+-#define FMODE_LSEEK   4
+-#define FMODE_PREAD   8
+-#define FMODE_PWRITE  FMODE_PREAD     /* These go hand in hand */
+-
+-/* File is being opened for execution. Primary users of this flag are
+-   distributed filesystems that can use it to achieve correct ETXTBUSY
+-   behavior for cross-node execution/opening_for_writing of files */
+-#define FMODE_EXEC    16
++/* file is open for reading */
++#define FMODE_READ            (1)
++/* file is open for writing */
++#define FMODE_WRITE           (2)
++/* file is seekable */
++#define FMODE_LSEEK           (4)
++/* file can be accessed using pread/pwrite */
++#define FMODE_PREAD           (8)
++#define FMODE_PWRITE          FMODE_PREAD     /* These go hand in hand */
++/* File is opened for execution with sys_execve / sys_uselib */
++#define FMODE_EXEC            (16)
+ #define RW_MASK               1
+ #define RWA_MASK      2
diff --git a/queue-2.6.27/seq_file-properly-cope-with-pread.patch b/queue-2.6.27/seq_file-properly-cope-with-pread.patch
new file mode 100644 (file)
index 0000000..67798f2
--- /dev/null
@@ -0,0 +1,119 @@
+From 8f19d472935c83d823fa4cf02bcc0a7b9952db30 Mon Sep 17 00:00:00 2001
+From: Eric Biederman <ebiederm@xmission.com>
+Date: Wed, 18 Feb 2009 14:48:16 -0800
+Subject: seq_file: properly cope with pread
+
+From: Eric Biederman <ebiederm@xmission.com>
+
+commit 8f19d472935c83d823fa4cf02bcc0a7b9952db30 upstream.
+
+Currently seq_read assumes that the offset passed to it is always the
+offset it passed to user space.  In the case pread this assumption is
+broken and we do the wrong thing when presented with pread.
+
+To solve this I introduce an offset cache inside of struct seq_file so we
+know where our logical file position is.  Then in seq_read if we try to
+read from another offset we reset our data structures and attempt to go to
+the offset user space wanted.
+
+[akpm@linux-foundation.org: restore FMODE_PWRITE]
+[pjt@google.com: seq_open needs its fmode opened up to take advantage of this]
+Signed-off-by: Eric Biederman <ebiederm@xmission.com>
+Cc: Alexey Dobriyan <adobriyan@gmail.com>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: Paul Turner <pjt@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/seq_file.c            |   36 ++++++++++++++++++++++++++++++++----
+ include/linux/seq_file.h |    1 +
+ 2 files changed, 33 insertions(+), 4 deletions(-)
+
+--- a/fs/seq_file.c
++++ b/fs/seq_file.c
+@@ -48,8 +48,16 @@ int seq_open(struct file *file, const st
+        */
+       file->f_version = 0;
+-      /* SEQ files support lseek, but not pread/pwrite */
+-      file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
++      /*
++       * seq_files support lseek() and pread().  They do not implement
++       * write() at all, but we clear FMODE_PWRITE here for historical
++       * reasons.
++       *
++       * If a client of seq_files a) implements file.write() and b) wishes to
++       * support pwrite() then that client will need to implement its own
++       * file.open() which calls seq_open() and then sets FMODE_PWRITE.
++       */
++      file->f_mode &= ~FMODE_PWRITE;
+       return 0;
+ }
+ EXPORT_SYMBOL(seq_open);
+@@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char
+       int err = 0;
+       mutex_lock(&m->lock);
++
++      /* Don't assume *ppos is where we left it */
++      if (unlikely(*ppos != m->read_pos)) {
++              m->read_pos = *ppos;
++              while ((err = traverse(m, *ppos)) == -EAGAIN)
++                      ;
++              if (err) {
++                      /* With prejudice... */
++                      m->read_pos = 0;
++                      m->version = 0;
++                      m->index = 0;
++                      m->count = 0;
++                      goto Done;
++              }
++      }
++
+       /*
+        * seq_file->op->..m_start/m_stop/m_next may do special actions
+        * or optimisations based on the file->f_version, so we want to
+@@ -230,8 +254,10 @@ Fill:
+ Done:
+       if (!copied)
+               copied = err;
+-      else
++      else {
+               *ppos += copied;
++              m->read_pos += copied;
++      }
+       file->f_version = m->version;
+       mutex_unlock(&m->lock);
+       return copied;
+@@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff
+                       if (offset < 0)
+                               break;
+                       retval = offset;
+-                      if (offset != file->f_pos) {
++                      if (offset != m->read_pos) {
+                               while ((retval=traverse(m, offset)) == -EAGAIN)
+                                       ;
+                               if (retval) {
+                                       /* with extreme prejudice... */
+                                       file->f_pos = 0;
++                                      m->read_pos = 0;
+                                       m->version = 0;
+                                       m->index = 0;
+                                       m->count = 0;
+                               } else {
++                                      m->read_pos = offset;
+                                       retval = file->f_pos = offset;
+                               }
+                       }
+--- a/include/linux/seq_file.h
++++ b/include/linux/seq_file.h
+@@ -19,6 +19,7 @@ struct seq_file {
+       size_t from;
+       size_t count;
+       loff_t index;
++      loff_t read_pos;
+       u64 version;
+       struct mutex lock;
+       const struct seq_operations *op;
index fcbf1072de6435658034b8fca437bba13f56d1a1..cd6550c4bf02e8d9f76151e5fc1b415df68a3f14 100644 (file)
@@ -4,3 +4,7 @@ net-amend-the-fix-for-so_bsdcompat-gsopt-infoleak.patch
 net-kill-skb_truesize_check-it-only-catches-false-positives.patch
 sparc64-fix-dax-handling-via-userspace-access-from-kernel.patch
 sparc-we-need-to-implement-arch_ptrace_stop.patch
+documnt-fmode_-constants.patch
+vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags.patch
+seq_file-properly-cope-with-pread.patch
+vt-declare-pio_cmap-gio_cmap-as-compatbile-ioctls.patch
diff --git a/queue-2.6.27/vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags.patch b/queue-2.6.27/vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags.patch
new file mode 100644 (file)
index 0000000..3780282
--- /dev/null
@@ -0,0 +1,61 @@
+From 55ec82176eca52e4e0530a82a0eb59160a1a95a1 Mon Sep 17 00:00:00 2001
+From: Paul Turner <pjt@google.com>
+Date: Wed, 18 Feb 2009 14:48:15 -0800
+Subject: vfs: separate FMODE_PREAD/FMODE_PWRITE into separate flags
+
+From: Paul Turner <pjt@google.com>
+
+commit 55ec82176eca52e4e0530a82a0eb59160a1a95a1 upstream.
+
+Separate FMODE_PREAD and FMODE_PWRITE into separate flags to reflect the
+reality that the read and write paths may have independent restrictions.
+
+A git grep verifies that these flags are always cleared together so this
+new behavior will only apply to interfaces that change to clear flags
+individually.
+
+This is required for "seq_file: properly cope with pread", a post-2.6.25
+regression fix.
+
+[akpm@linux-foundation.org: add comment]
+Signed-off-by: Paul Turner <pjt@google.com>
+Cc: Eric Biederman <ebiederm@xmission.com>
+Cc:  Alexey Dobriyan <adobriyan@gmail.com>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/fs.h |   12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -63,17 +63,23 @@ extern int dir_notify_enable;
+ #define MAY_ACCESS 16
+ #define MAY_OPEN 32
++/*
++ * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
++ * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
++ */
++
+ /* file is open for reading */
+ #define FMODE_READ            (1)
+ /* file is open for writing */
+ #define FMODE_WRITE           (2)
+ /* file is seekable */
+ #define FMODE_LSEEK           (4)
+-/* file can be accessed using pread/pwrite */
++/* file can be accessed using pread */
+ #define FMODE_PREAD           (8)
+-#define FMODE_PWRITE          FMODE_PREAD     /* These go hand in hand */
++/* file can be accessed using pwrite */
++#define FMODE_PWRITE          (16)
+ /* File is opened for execution with sys_execve / sys_uselib */
+-#define FMODE_EXEC            (16)
++#define FMODE_EXEC            (32)
+ #define RW_MASK               1
+ #define RWA_MASK      2
diff --git a/queue-2.6.27/vt-declare-pio_cmap-gio_cmap-as-compatbile-ioctls.patch b/queue-2.6.27/vt-declare-pio_cmap-gio_cmap-as-compatbile-ioctls.patch
new file mode 100644 (file)
index 0000000..622cb43
--- /dev/null
@@ -0,0 +1,33 @@
+From 2db69a9340da12a4db44edb7506dd68799aeff55 Mon Sep 17 00:00:00 2001
+From: Bill Nottingham <notting@redhat.com>
+Date: Wed, 18 Feb 2009 14:48:39 -0800
+Subject: vt: Declare PIO_CMAP/GIO_CMAP as compatbile ioctls.
+
+From: Bill Nottingham <notting@redhat.com>
+
+commit 2db69a9340da12a4db44edb7506dd68799aeff55 upstream.
+
+Otherwise, these don't work when called from 32-bit userspace on 64-bit
+kernels.
+
+Cc: Jiri Kosina <jkosina@suse.cz>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/compat_ioctl.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/compat_ioctl.c
++++ b/fs/compat_ioctl.c
+@@ -1938,6 +1938,8 @@ ULONG_IOCTL(SET_BITMAP_FILE)
+ /* Big K */
+ COMPATIBLE_IOCTL(PIO_FONT)
+ COMPATIBLE_IOCTL(GIO_FONT)
++COMPATIBLE_IOCTL(PIO_CMAP)
++COMPATIBLE_IOCTL(GIO_CMAP)
+ ULONG_IOCTL(KDSIGACCEPT)
+ COMPATIBLE_IOCTL(KDGETKEYCODE)
+ COMPATIBLE_IOCTL(KDSETKEYCODE)