]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jan 2021 09:38:29 +0000 (10:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jan 2021 09:38:29 +0000 (10:38 +0100)
added patches:
commit-9bb48c82aced-tty-implement-write_iter-converted-the-tty-layer-to-use-write_iter.-fix-the-redirected_tty_write-declaration-also-in-n_tty-and-change-the-comparisons-to-use-write_iter-instead-of-write.patch
fs-pipe-allow-sendfile-to-pipe-again.patch

queue-5.10/commit-9bb48c82aced-tty-implement-write_iter-converted-the-tty-layer-to-use-write_iter.-fix-the-redirected_tty_write-declaration-also-in-n_tty-and-change-the-comparisons-to-use-write_iter-instead-of-write.patch [new file with mode: 0644]
queue-5.10/fs-pipe-allow-sendfile-to-pipe-again.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/commit-9bb48c82aced-tty-implement-write_iter-converted-the-tty-layer-to-use-write_iter.-fix-the-redirected_tty_write-declaration-also-in-n_tty-and-change-the-comparisons-to-use-write_iter-instead-of-write.patch b/queue-5.10/commit-9bb48c82aced-tty-implement-write_iter-converted-the-tty-layer-to-use-write_iter.-fix-the-redirected_tty_write-declaration-also-in-n_tty-and-change-the-comparisons-to-use-write_iter-instead-of-write.patch
new file mode 100644 (file)
index 0000000..87b5907
--- /dev/null
@@ -0,0 +1,83 @@
+From 9f12e37cae44a96132fc3031535a0b165486941a Mon Sep 17 00:00:00 2001
+From: Sami Tolvanen <samitolvanen@google.com>
+Date: Mon, 25 Jan 2021 11:09:25 -0800
+Subject: Commit 9bb48c82aced ("tty: implement write_iter") converted the tty layer to use write_iter. Fix the redirected_tty_write declaration also in n_tty and change the comparisons to use write_iter instead of write.
+ also in n_tty and change the comparisons to use write_iter instead of write.
+
+From: Sami Tolvanen <samitolvanen@google.com>
+
+commit 9f12e37cae44a96132fc3031535a0b165486941a upstream.
+
+[ Also moved the declaration of redirected_tty_write() to the proper
+  location in a header file. The reason for the bug was the bogus extern
+  declaration in n_tty.c silently not matching the changed definition in
+  tty_io.c, and because it wasn't in a shared header file, there was no
+  cross-checking of the declaration.
+
+  Sami noticed because Clang's Control Flow Integrity checking ended up
+  incidentally noticing the inconsistent declaration.    - Linus ]
+
+Fixes: 9bb48c82aced ("tty: implement write_iter")
+Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/n_tty.c  |    7 ++-----
+ drivers/tty/tty_io.c |    2 --
+ include/linux/tty.h  |    1 +
+ 3 files changed, 3 insertions(+), 7 deletions(-)
+
+--- a/drivers/tty/n_tty.c
++++ b/drivers/tty/n_tty.c
+@@ -2079,9 +2079,6 @@ static int canon_copy_from_read_buf(stru
+       return 0;
+ }
+-extern ssize_t redirected_tty_write(struct file *, const char __user *,
+-                                                      size_t, loff_t *);
+-
+ /**
+  *    job_control             -       check job control
+  *    @tty: tty
+@@ -2103,7 +2100,7 @@ static int job_control(struct tty_struct
+       /* NOTE: not yet done after every sleep pending a thorough
+          check of the logic of this change. -- jlc */
+       /* don't stop on /dev/console */
+-      if (file->f_op->write == redirected_tty_write)
++      if (file->f_op->write_iter == redirected_tty_write)
+               return 0;
+       return __tty_check_change(tty, SIGTTIN);
+@@ -2307,7 +2304,7 @@ static ssize_t n_tty_write(struct tty_st
+       ssize_t retval = 0;
+       /* Job control check -- must be done at start (POSIX.1 7.1.1.4). */
+-      if (L_TOSTOP(tty) && file->f_op->write != redirected_tty_write) {
++      if (L_TOSTOP(tty) && file->f_op->write_iter != redirected_tty_write) {
+               retval = tty_check_change(tty);
+               if (retval)
+                       return retval;
+--- a/drivers/tty/tty_io.c
++++ b/drivers/tty/tty_io.c
+@@ -144,10 +144,8 @@ DEFINE_MUTEX(tty_mutex);
+ static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
+ static ssize_t tty_write(struct kiocb *, struct iov_iter *);
+-ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *);
+ static __poll_t tty_poll(struct file *, poll_table *);
+ static int tty_open(struct inode *, struct file *);
+-long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+ #ifdef CONFIG_COMPAT
+ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg);
+--- a/include/linux/tty.h
++++ b/include/linux/tty.h
+@@ -422,6 +422,7 @@ extern void tty_kclose(struct tty_struct
+ extern int tty_dev_name_to_number(const char *name, dev_t *number);
+ extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
+ extern void tty_ldisc_unlock(struct tty_struct *tty);
++extern ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *);
+ #else
+ static inline void tty_kref_put(struct tty_struct *tty)
+ { }
diff --git a/queue-5.10/fs-pipe-allow-sendfile-to-pipe-again.patch b/queue-5.10/fs-pipe-allow-sendfile-to-pipe-again.patch
new file mode 100644 (file)
index 0000000..10e81c2
--- /dev/null
@@ -0,0 +1,41 @@
+From f8ad8187c3b536ee2b10502a8340c014204a1af0 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes@sipsolutions.net>
+Date: Mon, 25 Jan 2021 10:16:15 +0100
+Subject: fs/pipe: allow sendfile() to pipe again
+
+From: Johannes Berg <johannes@sipsolutions.net>
+
+commit f8ad8187c3b536ee2b10502a8340c014204a1af0 upstream.
+
+After commit 36e2c7421f02 ("fs: don't allow splice read/write
+without explicit ops") sendfile() could no longer send data
+from a real file to a pipe, breaking for example certain cgit
+setups (e.g. when running behind fcgiwrap), because in this
+case cgit will try to do exactly this: sendfile() to a pipe.
+
+Fix this by using iter_file_splice_write for the splice_write
+method of pipes, as suggested by Christoph.
+
+Cc: stable@vger.kernel.org
+Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
+Suggested-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Tested-by: Johannes Berg <johannes@sipsolutions.net>
+Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/pipe.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/pipe.c
++++ b/fs/pipe.c
+@@ -1206,6 +1206,7 @@ const struct file_operations pipefifo_fo
+       .unlocked_ioctl = pipe_ioctl,
+       .release        = pipe_release,
+       .fasync         = pipe_fasync,
++      .splice_write   = iter_file_splice_write,
+ };
+ /*
index 267c1e78845bd4564a4934d10e500940a0a1290c..772c3a031893ccfaabda44dc6758aa2297e0cd70 100644 (file)
@@ -199,3 +199,5 @@ kernfs-implement-read_iter.patch
 kernfs-implement-write_iter.patch
 kernfs-wire-up-splice_read-and-splice_write.patch
 interconnect-imx8mq-use-icc_sync_state.patch
+fs-pipe-allow-sendfile-to-pipe-again.patch
+commit-9bb48c82aced-tty-implement-write_iter-converted-the-tty-layer-to-use-write_iter.-fix-the-redirected_tty_write-declaration-also-in-n_tty-and-change-the-comparisons-to-use-write_iter-instead-of-write.patch