From: Greg Kroah-Hartman Date: Tue, 3 Mar 2009 01:37:44 +0000 (-0800) Subject: .27 patches X-Git-Tag: v2.6.28.8~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d3616848ace921845e73b0fc97f6b129c07447f;p=thirdparty%2Fkernel%2Fstable-queue.git .27 patches --- diff --git a/queue-2.6.27/documnt-fmode_-constants.patch b/queue-2.6.27/documnt-fmode_-constants.patch new file mode 100644 index 00000000000..4f8cab4e41b --- /dev/null +++ b/queue-2.6.27/documnt-fmode_-constants.patch @@ -0,0 +1,55 @@ +From fc9161e54d0dbf799beff9692ea1cc6237162b85 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig +Date: Wed, 5 Nov 2008 14:58:46 +0100 +Subject: documnt FMODE_ constants + +From: Christoph Hellwig + +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 +Signed-off-by: Al Viro +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..67798f2a515 --- /dev/null +++ b/queue-2.6.27/seq_file-properly-cope-with-pread.patch @@ -0,0 +1,119 @@ +From 8f19d472935c83d823fa4cf02bcc0a7b9952db30 Mon Sep 17 00:00:00 2001 +From: Eric Biederman +Date: Wed, 18 Feb 2009 14:48:16 -0800 +Subject: seq_file: properly cope with pread + +From: Eric Biederman + +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 +Cc: Alexey Dobriyan +Cc: Al Viro +Cc: Paul Turner +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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; diff --git a/queue-2.6.27/series b/queue-2.6.27/series index fcbf1072de6..cd6550c4bf0 100644 --- a/queue-2.6.27/series +++ b/queue-2.6.27/series @@ -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 index 00000000000..3780282d6eb --- /dev/null +++ b/queue-2.6.27/vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags.patch @@ -0,0 +1,61 @@ +From 55ec82176eca52e4e0530a82a0eb59160a1a95a1 Mon Sep 17 00:00:00 2001 +From: Paul Turner +Date: Wed, 18 Feb 2009 14:48:15 -0800 +Subject: vfs: separate FMODE_PREAD/FMODE_PWRITE into separate flags + +From: Paul Turner + +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 +Cc: Eric Biederman +Cc: Alexey Dobriyan +Cc: Al Viro +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..622cb438f53 --- /dev/null +++ b/queue-2.6.27/vt-declare-pio_cmap-gio_cmap-as-compatbile-ioctls.patch @@ -0,0 +1,33 @@ +From 2db69a9340da12a4db44edb7506dd68799aeff55 Mon Sep 17 00:00:00 2001 +From: Bill Nottingham +Date: Wed, 18 Feb 2009 14:48:39 -0800 +Subject: vt: Declare PIO_CMAP/GIO_CMAP as compatbile ioctls. + +From: Bill Nottingham + +commit 2db69a9340da12a4db44edb7506dd68799aeff55 upstream. + +Otherwise, these don't work when called from 32-bit userspace on 64-bit +kernels. + +Cc: Jiri Kosina +Cc: Alan Cox +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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)