]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Jul 2018 16:54:49 +0000 (18:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Jul 2018 16:54:49 +0000 (18:54 +0200)
added patches:
i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch
ipv4-fix-error-return-value-in-fib_convert_metrics.patch
kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch

queue-4.9/i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch [new file with mode: 0644]
queue-4.9/ipv4-fix-error-return-value-in-fib_convert_metrics.patch [new file with mode: 0644]
queue-4.9/kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch b/queue-4.9/i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch
new file mode 100644 (file)
index 0000000..14e55f1
--- /dev/null
@@ -0,0 +1,44 @@
+From ae481cc139658e89eb3ea671dd00b67bd87f01a3 Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Date: Tue, 18 Apr 2017 20:38:35 +0200
+Subject: i2c: rcar: fix resume by always initializing registers before transfer
+
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+
+commit ae481cc139658e89eb3ea671dd00b67bd87f01a3 upstream.
+
+Resume failed because of uninitialized registers. Instead of adding a
+resume callback, we simply initialize registers before every transfer.
+This lightweight change is more robust and will keep us safe if we ever
+need support for power domains or dynamic frequency changes.
+
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/i2c/busses/i2c-rcar.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -700,6 +700,8 @@ static int rcar_i2c_master_xfer(struct i
+       pm_runtime_get_sync(dev);
++      rcar_i2c_init(priv);
++
+       ret = rcar_i2c_bus_barrier(priv);
+       if (ret < 0)
+               goto out;
+@@ -857,8 +859,6 @@ static int rcar_i2c_probe(struct platfor
+       if (ret < 0)
+               goto out_pm_put;
+-      rcar_i2c_init(priv);
+-
+       /* Don't suspend when multi-master to keep arbitration working */
+       if (of_property_read_bool(dev->of_node, "multi-master"))
+               priv->flags |= ID_P_PM_BLOCKED;
diff --git a/queue-4.9/ipv4-fix-error-return-value-in-fib_convert_metrics.patch b/queue-4.9/ipv4-fix-error-return-value-in-fib_convert_metrics.patch
new file mode 100644 (file)
index 0000000..4b94308
--- /dev/null
@@ -0,0 +1,34 @@
+From ben.hutchings@codethink.co.uk  Thu Jul  5 18:24:02 2018
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Date: Tue, 19 Jun 2018 18:47:52 +0100
+Subject: ipv4: Fix error return value in fib_convert_metrics()
+To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>
+Message-ID: <20180619174752.tpvgu5pcvuzwac6c@xylophone.i.decadent.org.uk>
+Content-Disposition: inline
+
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+
+The validation code modified by commit 5b5e7a0de2bb ("net: metrics:
+add proper netlink validation") is organised differently in older
+kernel versions.  The fib_convert_metrics() function that is modified
+in the backports to 4.4 and 4.9 needs to returns an error code, not a
+success flag.
+
+Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/fib_semantics.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/ipv4/fib_semantics.c
++++ b/net/ipv4/fib_semantics.c
+@@ -980,7 +980,7 @@ fib_convert_metrics(struct fib_info *fi,
+                               return -EINVAL;
+               } else {
+                       if (nla_len(nla) != sizeof(u32))
+-                              return false;
++                              return -EINVAL;
+                       val = nla_get_u32(nla);
+               }
+               if (type == RTAX_ADVMSS && val > 65535 - 40)
diff --git a/queue-4.9/kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch b/queue-4.9/kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch
new file mode 100644 (file)
index 0000000..5ddde7a
--- /dev/null
@@ -0,0 +1,107 @@
+From 804dec5bda9b4fcdab5f67fe61db4a0498af5221 Mon Sep 17 00:00:00 2001
+From: Masami Hiramatsu <mhiramat@kernel.org>
+Date: Wed, 29 Mar 2017 14:00:25 +0900
+Subject: kprobes/x86: Do not modify singlestep buffer while resuming
+
+From: Masami Hiramatsu <mhiramat@kernel.org>
+
+commit 804dec5bda9b4fcdab5f67fe61db4a0498af5221 upstream.
+
+Do not modify singlestep execution buffer (kprobe.ainsn.insn)
+while resuming from single-stepping, instead, modifies
+the buffer to add a jump back instruction at preparing
+buffer.
+
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: David S . Miller <davem@davemloft.net>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Ye Xiaolong <xiaolong.ye@intel.com>
+Link: http://lkml.kernel.org/r/149076361560.22469.1610155860343077495.stgit@devbox
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Reviewed-by: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/kprobes/core.c |   42 +++++++++++++++++++----------------------
+ 1 file changed, 20 insertions(+), 22 deletions(-)
+
+--- a/arch/x86/kernel/kprobes/core.c
++++ b/arch/x86/kernel/kprobes/core.c
+@@ -414,25 +414,38 @@ void free_insn_page(void *page)
+       module_memfree(page);
+ }
++/* Prepare reljump right after instruction to boost */
++static void prepare_boost(struct kprobe *p, int length)
++{
++      if (can_boost(p->ainsn.insn, p->addr) &&
++          MAX_INSN_SIZE - length >= RELATIVEJUMP_SIZE) {
++              /*
++               * These instructions can be executed directly if it
++               * jumps back to correct address.
++               */
++              synthesize_reljump(p->ainsn.insn + length, p->addr + length);
++              p->ainsn.boostable = 1;
++      } else {
++              p->ainsn.boostable = -1;
++      }
++}
++
+ static int arch_copy_kprobe(struct kprobe *p)
+ {
+-      int ret;
++      int len;
+       set_memory_rw((unsigned long)p->ainsn.insn & PAGE_MASK, 1);
+       /* Copy an instruction with recovering if other optprobe modifies it.*/
+-      ret = __copy_instruction(p->ainsn.insn, p->addr);
+-      if (!ret)
++      len = __copy_instruction(p->ainsn.insn, p->addr);
++      if (!len)
+               return -EINVAL;
+       /*
+        * __copy_instruction can modify the displacement of the instruction,
+        * but it doesn't affect boostable check.
+        */
+-      if (can_boost(p->ainsn.insn, p->addr))
+-              p->ainsn.boostable = 0;
+-      else
+-              p->ainsn.boostable = -1;
++      prepare_boost(p, len);
+       set_memory_ro((unsigned long)p->ainsn.insn & PAGE_MASK, 1);
+@@ -897,21 +910,6 @@ static void resume_execution(struct kpro
+               break;
+       }
+-      if (p->ainsn.boostable == 0) {
+-              if ((regs->ip > copy_ip) &&
+-                  (regs->ip - copy_ip) + 5 < MAX_INSN_SIZE) {
+-                      /*
+-                       * These instructions can be executed directly if it
+-                       * jumps back to correct address.
+-                       */
+-                      synthesize_reljump((void *)regs->ip,
+-                              (void *)orig_ip + (regs->ip - copy_ip));
+-                      p->ainsn.boostable = 1;
+-              } else {
+-                      p->ainsn.boostable = -1;
+-              }
+-      }
+-
+       regs->ip += orig_ip - copy_ip;
+ no_change:
index 9d169086bc43b9cbd2a98bf41c6b10e7402f6fef..6969e553156dc10b0260f3d248d03310c046adfa 100644 (file)
@@ -6,3 +6,6 @@ n_tty-fix-stall-at-n_tty_receive_char_special.patch
 n_tty-access-echo_-variables-carefully.patch
 staging-android-ion-return-an-err_ptr-in-ion_map_kernel.patch
 vt-prevent-leaking-uninitialized-data-to-userspace-via-dev-vcs.patch
+i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch
+ipv4-fix-error-return-value-in-fib_convert_metrics.patch
+kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch