]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 12:54:49 +0000 (14:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 12:54:49 +0000 (14:54 +0200)
added patches:
arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch
parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch

queue-4.4/arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch [new file with mode: 0644]
queue-4.4/parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch b/queue-4.4/arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch
new file mode 100644 (file)
index 0000000..7b63ebd
--- /dev/null
@@ -0,0 +1,80 @@
+From b4d5ec9b39f8b31d98f65bc5577b5d15d93795d7 Mon Sep 17 00:00:00 2001
+From: Nathan Huckleberry <nhuck@google.com>
+Date: Fri, 10 Jul 2020 20:23:37 +0100
+Subject: ARM: 8992/1: Fix unwind_frame for clang-built kernels
+
+From: Nathan Huckleberry <nhuck@google.com>
+
+commit b4d5ec9b39f8b31d98f65bc5577b5d15d93795d7 upstream.
+
+Since clang does not push pc and sp in function prologues, the current
+implementation of unwind_frame does not work. By using the previous
+frame's lr/fp instead of saved pc/sp we get valid unwinds on clang-built
+kernels.
+
+The bounds check on next frame pointer must be changed as well since
+there are 8 less bytes between frames.
+
+This fixes /proc/<pid>/stack.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/912
+
+Reported-by: Miles Chen <miles.chen@mediatek.com>
+Tested-by: Miles Chen <miles.chen@mediatek.com>
+Cc: stable@vger.kernel.org
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nathan Huckleberry <nhuck@google.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kernel/stacktrace.c |   24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/arch/arm/kernel/stacktrace.c
++++ b/arch/arm/kernel/stacktrace.c
+@@ -19,6 +19,19 @@
+  * A simple function epilogue looks like this:
+  *    ldm     sp, {fp, sp, pc}
+  *
++ * When compiled with clang, pc and sp are not pushed. A simple function
++ * prologue looks like this when built with clang:
++ *
++ *    stmdb   {..., fp, lr}
++ *    add     fp, sp, #x
++ *    sub     sp, sp, #y
++ *
++ * A simple function epilogue looks like this when built with clang:
++ *
++ *    sub     sp, fp, #x
++ *    ldm     {..., fp, pc}
++ *
++ *
+  * Note that with framepointer enabled, even the leaf functions have the same
+  * prologue and epilogue, therefore we can ignore the LR value in this case.
+  */
+@@ -31,6 +44,16 @@ int notrace unwind_frame(struct stackfra
+       low = frame->sp;
+       high = ALIGN(low, THREAD_SIZE);
++#ifdef CONFIG_CC_IS_CLANG
++      /* check current frame pointer is within bounds */
++      if (fp < low + 4 || fp > high - 4)
++              return -EINVAL;
++
++      frame->sp = frame->fp;
++      frame->fp = *(unsigned long *)(fp);
++      frame->pc = frame->lr;
++      frame->lr = *(unsigned long *)(fp + 4);
++#else
+       /* check current frame pointer is within bounds */
+       if (fp < low + 12 || fp > high - 4)
+               return -EINVAL;
+@@ -39,6 +62,7 @@ int notrace unwind_frame(struct stackfra
+       frame->fp = *(unsigned long *)(fp - 12);
+       frame->sp = *(unsigned long *)(fp - 8);
+       frame->pc = *(unsigned long *)(fp - 4);
++#endif
+       return 0;
+ }
diff --git a/queue-4.4/parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch b/queue-4.4/parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch
new file mode 100644 (file)
index 0000000..3a2ae9d
--- /dev/null
@@ -0,0 +1,33 @@
+From 5b24993c21cbf2de11aff077a48c5cb0505a0450 Mon Sep 17 00:00:00 2001
+From: Sven Schnelle <svens@stackframe.org>
+Date: Tue, 11 Aug 2020 18:19:19 +0200
+Subject: parisc: mask out enable and reserved bits from sba imask
+
+From: Sven Schnelle <svens@stackframe.org>
+
+commit 5b24993c21cbf2de11aff077a48c5cb0505a0450 upstream.
+
+When using kexec the SBA IOMMU IBASE might still have the RE
+bit set. This triggers a WARN_ON when trying to write back the
+IBASE register later, and it also makes some mask calculations fail.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Sven Schnelle <svens@stackframe.org>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/parisc/sba_iommu.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/parisc/sba_iommu.c
++++ b/drivers/parisc/sba_iommu.c
+@@ -1277,7 +1277,7 @@ sba_ioc_init_pluto(struct parisc_device
+       ** (one that doesn't overlap memory or LMMIO space) in the
+       ** IBASE and IMASK registers.
+       */
+-      ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE);
++      ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE) & ~0x1fffffULL;
+       iova_space_size = ~(READ_REG(ioc->ioc_hpa + IOC_IMASK) & 0xFFFFFFFFUL) + 1;
+       if ((ioc->ibase < 0xfed00000UL) && ((ioc->ibase + iova_space_size) > 0xfee00000UL)) {
index 1ff98f5d8244c895c2439a7f5dca46d7d6da3abc..3a9fd8acbb10bfef18c76ba9ac37cab950b0055d 100644 (file)
@@ -113,3 +113,5 @@ fs-minix-don-t-allow-getting-deleted-inodes.patch
 fs-minix-reject-too-large-maximum-file-size.patch
 alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch
 9p-fix-memory-leak-in-v9fs_mount.patch
+parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch
+arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch