]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Nov 2018 11:52:13 +0000 (12:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Nov 2018 11:52:13 +0000 (12:52 +0100)
added patches:
include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch
tty-wipe-buffer-if-not-echoing-data.patch
tty-wipe-buffer.patch

queue-4.9/include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/tty-wipe-buffer-if-not-echoing-data.patch [new file with mode: 0644]
queue-4.9/tty-wipe-buffer.patch [new file with mode: 0644]

diff --git a/queue-4.9/include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch b/queue-4.9/include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch
new file mode 100644 (file)
index 0000000..70b63ac
--- /dev/null
@@ -0,0 +1,70 @@
+From 4d54954a197175c0dcb3c82af0c0740d0c5f827a Mon Sep 17 00:00:00 2001
+From: Sebastien Boisvert <sebhtml@videotron.qc.ca>
+Date: Fri, 26 Oct 2018 15:02:23 -0700
+Subject: include/linux/pfn_t.h: force '~' to be parsed as an unary operator
+
+From: Sebastien Boisvert <sebhtml@videotron.qc.ca>
+
+commit 4d54954a197175c0dcb3c82af0c0740d0c5f827a upstream.
+
+Tracing the event "fs_dax:dax_pmd_insert_mapping" with perf produces this
+warning:
+
+      [fs_dax:dax_pmd_insert_mapping] unknown op '~'
+
+It is printed in process_op (tools/lib/traceevent/event-parse.c) because
+'~' is parsed as a binary operator.
+
+perf reads the format of fs_dax:dax_pmd_insert_mapping ("print fmt") from
+/sys/kernel/debug/tracing/events/fs_dax/dax_pmd_insert_mapping/format .
+
+The format contains:
+
+~(((u64) ~(~(((1UL) << 12)-1)))
+         ^
+         \ interpreted as a binary operator by process_op().
+
+This part is generated in the declaration of the event class
+dax_pmd_insert_mapping_class in include/trace/events/fs_dax.h :
+
+               __print_flags_u64(__entry->pfn_val & PFN_FLAGS_MASK, "|",
+                       PFN_FLAGS_TRACE),
+
+This patch adds a pair of parentheses in the declaration of PFN_FLAGS_MASK
+to make sure that '~' is parsed as a unary operator by perf.
+
+The part of the format that was problematic is now:
+
+~(((u64) (~(~(((1UL) << 12)-1))))
+
+Now, all the '~' are parsed as unary operators.
+
+Link: http://lkml.kernel.org/r/20181021145939.8760-1-sebhtml@videotron.qc.ca
+Signed-off-by: Sebastien Boisvert <sebhtml@videotron.qc.ca>
+Acked-by: Dan Williams <dan.j.williams@intel.com>
+Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Ross Zwisler <zwisler@kernel.org>
+Cc: Elenie Godzaridis <arangradient@gmail.com>
+Cc: <stable@vger.kerenl.org>
+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@linuxfoundation.org>
+
+---
+ include/linux/pfn_t.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/pfn_t.h
++++ b/include/linux/pfn_t.h
+@@ -9,7 +9,7 @@
+  * PFN_DEV - pfn is not covered by system memmap by default
+  * PFN_MAP - pfn has a dynamic page mapping established by a device driver
+  */
+-#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT))
++#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - PAGE_SHIFT))
+ #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
+ #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
+ #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
index 842095cf13253c469f3b963b5c9e6072976208e0..73d3d3173b86749ecd1ecd00233f1e03b489fbb8 100644 (file)
@@ -76,3 +76,6 @@ scsi-ufs-fix-bugs-related-to-null-pointer-access-and-array-size.patch
 scsi-ufshcd-fix-race-between-clk-scaling-and-ungate-work.patch
 scsi-ufs-fix-race-between-clock-gating-and-devfreq-scaling-work.patch
 scsi-ufshcd-release-resources-if-probe-fails.patch
+include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch
+tty-wipe-buffer.patch
+tty-wipe-buffer-if-not-echoing-data.patch
diff --git a/queue-4.9/tty-wipe-buffer-if-not-echoing-data.patch b/queue-4.9/tty-wipe-buffer-if-not-echoing-data.patch
new file mode 100644 (file)
index 0000000..6f7bf20
--- /dev/null
@@ -0,0 +1,83 @@
+From b97b3d9fb57860a60592859e332de7759fd54c2e Mon Sep 17 00:00:00 2001
+From: Greg KH <greg@kroah.com>
+Date: Thu, 4 Oct 2018 11:06:14 -0700
+Subject: tty: wipe buffer if not echoing data
+
+From: Greg Kroah-Hartman <greg@kroah.com>
+
+commit b97b3d9fb57860a60592859e332de7759fd54c2e upstream.
+
+If we are not echoing the data to userspace or the console is in icanon
+mode, then perhaps it is a "secret" so we should wipe it once we are
+done with it.
+
+This mirrors the logic that the audit code has.
+
+Reported-by: aszlig <aszlig@nix.build>
+Tested-by: Milan Broz <gmazyland@gmail.com>
+Tested-by: Daniel Zatovic <daniel.zatovic@gmail.com>
+Tested-by: aszlig <aszlig@nix.build>
+Cc: Willy Tarreau <w@1wt.eu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/n_tty.c |   20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+--- a/drivers/tty/n_tty.c
++++ b/drivers/tty/n_tty.c
+@@ -154,17 +154,28 @@ static inline unsigned char *echo_buf_ad
+       return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)];
+ }
++/* If we are not echoing the data, perhaps this is a secret so erase it */
++static void zero_buffer(struct tty_struct *tty, u8 *buffer, int size)
++{
++      bool icanon = !!L_ICANON(tty);
++      bool no_echo = !L_ECHO(tty);
++
++      if (icanon && no_echo)
++              memset(buffer, 0x00, size);
++}
++
+ static int tty_copy_to_user(struct tty_struct *tty, void __user *to,
+                           size_t tail, size_t n)
+ {
+       struct n_tty_data *ldata = tty->disc_data;
+       size_t size = N_TTY_BUF_SIZE - tail;
+-      const void *from = read_buf_addr(ldata, tail);
++      void *from = read_buf_addr(ldata, tail);
+       int uncopied;
+       if (n > size) {
+               tty_audit_add_data(tty, from, size);
+               uncopied = copy_to_user(to, from, size);
++              zero_buffer(tty, from, size - uncopied);
+               if (uncopied)
+                       return uncopied;
+               to += size;
+@@ -173,7 +184,9 @@ static int tty_copy_to_user(struct tty_s
+       }
+       tty_audit_add_data(tty, from, n);
+-      return copy_to_user(to, from, n);
++      uncopied = copy_to_user(to, from, n);
++      zero_buffer(tty, from, n - uncopied);
++      return uncopied;
+ }
+ /**
+@@ -1962,11 +1975,12 @@ static int copy_from_read_buf(struct tty
+       n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail);
+       n = min(*nr, n);
+       if (n) {
+-              const unsigned char *from = read_buf_addr(ldata, tail);
++              unsigned char *from = read_buf_addr(ldata, tail);
+               retval = copy_to_user(*b, from, n);
+               n -= retval;
+               is_eof = n == 1 && *from == EOF_CHAR(tty);
+               tty_audit_add_data(tty, from, n);
++              zero_buffer(tty, from, n);
+               smp_store_release(&ldata->read_tail, ldata->read_tail + n);
+               /* Turn single EOF into zero-length read */
+               if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
diff --git a/queue-4.9/tty-wipe-buffer.patch b/queue-4.9/tty-wipe-buffer.patch
new file mode 100644 (file)
index 0000000..3b08452
--- /dev/null
@@ -0,0 +1,33 @@
+From c9a8e5fce009e3c601a43c49ea9dbcb25d1ffac5 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Thu, 4 Oct 2018 11:06:13 -0700
+Subject: tty: wipe buffer.
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit c9a8e5fce009e3c601a43c49ea9dbcb25d1ffac5 upstream.
+
+After we are done with the tty buffer, zero it out.
+
+Reported-by: aszlig <aszlig@nix.build>
+Tested-by: Milan Broz <gmazyland@gmail.com>
+Tested-by: Daniel Zatovic <daniel.zatovic@gmail.com>
+Tested-by: aszlig <aszlig@nix.build>
+Cc: Willy Tarreau <w@1wt.eu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/tty_buffer.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/tty/tty_buffer.c
++++ b/drivers/tty/tty_buffer.c
+@@ -458,6 +458,8 @@ int tty_ldisc_receive_buf(struct tty_ldi
+               if (count && ld->ops->receive_buf)
+                       ld->ops->receive_buf(ld->tty, p, f, count);
+       }
++      if (count > 0)
++              memset(p, 0, count);
+       return count;
+ }
+ EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf);