From 0ec25cf7092ed08c1fc73f82b4dae6c0a03effdc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2020 14:54:49 +0200 Subject: [PATCH] 4.4-stable patches added patches: arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch --- ...unwind_frame-for-clang-built-kernels.patch | 80 +++++++++++++++++++ ...ble-and-reserved-bits-from-sba-imask.patch | 33 ++++++++ queue-4.4/series | 2 + 3 files changed, 115 insertions(+) create mode 100644 queue-4.4/arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch create mode 100644 queue-4.4/parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch 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 index 00000000000..7b63ebd86da --- /dev/null +++ b/queue-4.4/arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch @@ -0,0 +1,80 @@ +From b4d5ec9b39f8b31d98f65bc5577b5d15d93795d7 Mon Sep 17 00:00:00 2001 +From: Nathan Huckleberry +Date: Fri, 10 Jul 2020 20:23:37 +0100 +Subject: ARM: 8992/1: Fix unwind_frame for clang-built kernels + +From: Nathan Huckleberry + +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//stack. + +Link: https://github.com/ClangBuiltLinux/linux/issues/912 + +Reported-by: Miles Chen +Tested-by: Miles Chen +Cc: stable@vger.kernel.org +Reviewed-by: Nick Desaulniers +Signed-off-by: Nathan Huckleberry +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..3a2ae9dfe4b --- /dev/null +++ b/queue-4.4/parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch @@ -0,0 +1,33 @@ +From 5b24993c21cbf2de11aff077a48c5cb0505a0450 Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Tue, 11 Aug 2020 18:19:19 +0200 +Subject: parisc: mask out enable and reserved bits from sba imask + +From: Sven Schnelle + +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: +Signed-off-by: Sven Schnelle +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman + +--- + 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)) { diff --git a/queue-4.4/series b/queue-4.4/series index 1ff98f5d824..3a9fd8acbb1 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -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 -- 2.47.3