From: Greg Kroah-Hartman Date: Thu, 29 Nov 2018 11:52:13 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.19.6~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b08a2e74ea22f778341c6158ff1754855c84c09;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches 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 --- 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 index 00000000000..70b63ac4691 --- /dev/null +++ b/queue-4.9/include-linux-pfn_t.h-force-to-be-parsed-as-an-unary-operator.patch @@ -0,0 +1,70 @@ +From 4d54954a197175c0dcb3c82af0c0740d0c5f827a Mon Sep 17 00:00:00 2001 +From: Sebastien Boisvert +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 + +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 +Acked-by: Dan Williams +Cc: "Steven Rostedt (VMware)" +Cc: Arnaldo Carvalho de Melo +Cc: "Tzvetomir Stoyanov (VMware)" +Cc: Namhyung Kim +Cc: Ross Zwisler +Cc: Elenie Godzaridis +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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)) diff --git a/queue-4.9/series b/queue-4.9/series index 842095cf132..73d3d3173b8 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -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 index 00000000000..6f7bf202d1f --- /dev/null +++ b/queue-4.9/tty-wipe-buffer-if-not-echoing-data.patch @@ -0,0 +1,83 @@ +From b97b3d9fb57860a60592859e332de7759fd54c2e Mon Sep 17 00:00:00 2001 +From: Greg KH +Date: Thu, 4 Oct 2018 11:06:14 -0700 +Subject: tty: wipe buffer if not echoing data + +From: Greg Kroah-Hartman + +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 +Tested-by: Milan Broz +Tested-by: Daniel Zatovic +Tested-by: aszlig +Cc: Willy Tarreau +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..3b084526a38 --- /dev/null +++ b/queue-4.9/tty-wipe-buffer.patch @@ -0,0 +1,33 @@ +From c9a8e5fce009e3c601a43c49ea9dbcb25d1ffac5 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Thu, 4 Oct 2018 11:06:13 -0700 +Subject: tty: wipe buffer. + +From: Linus Torvalds + +commit c9a8e5fce009e3c601a43c49ea9dbcb25d1ffac5 upstream. + +After we are done with the tty buffer, zero it out. + +Reported-by: aszlig +Tested-by: Milan Broz +Tested-by: Daniel Zatovic +Tested-by: aszlig +Cc: Willy Tarreau +Signed-off-by: Greg Kroah-Hartman + +--- + 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);