summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2017-06-12 12:15:03 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2017-06-12 12:15:03 -0400
commit00cf76d5ab1162f4895b994b1cd8b6da99046983 (patch)
tree1f3536f1d5e763cdea15467199bcdd5177087033
parent9c1abec361e57893e35061737ca3988538284a6b (diff)
downloadlongterm-queue-4.8-00cf76d5ab1162f4895b994b1cd8b6da99046983.tar.gz
powerpc: add shim patch needed for follow-on patch
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/powerpc-kernel-Use-kprobe-blacklist-for-asm-function.patch132
-rw-r--r--queue/series1
2 files changed, 133 insertions, 0 deletions
diff --git a/queue/powerpc-kernel-Use-kprobe-blacklist-for-asm-function.patch b/queue/powerpc-kernel-Use-kprobe-blacklist-for-asm-function.patch
new file mode 100644
index 0000000..6453f71
--- /dev/null
+++ b/queue/powerpc-kernel-Use-kprobe-blacklist-for-asm-function.patch
@@ -0,0 +1,132 @@
+From 6f698df10cb24d466b9a790b9daedb9e7bcd5d2a Mon Sep 17 00:00:00 2001
+From: Nicholas Piggin <npiggin@gmail.com>
+Date: Fri, 16 Sep 2016 20:48:17 +1000
+Subject: [PATCH] powerpc/kernel: Use kprobe blacklist for asm functions
+
+commit 6f698df10cb24d466b9a790b9daedb9e7bcd5d2a upstream.
+
+Rather than forcing the whole function into the ".kprobes.text" section,
+just add the symbol's address to the kprobe blacklist.
+
+This also lets us drop the three versions of the_KPROBE macro, in
+exchange for just one version of _ASM_NOKPROBE_SYMBOL - which is a good
+cleanup.
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+
+diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
+index d5d5b5e348f2..cd39ac127786 100644
+--- a/arch/powerpc/include/asm/ppc_asm.h
++++ b/arch/powerpc/include/asm/ppc_asm.h
+@@ -217,13 +217,6 @@ name: \
+ addi r2,r2,(.TOC.-0b)@l; \
+ .localentry name,.-name
+
+-#define _KPROBE(name) \
+- .section ".kprobes.text","a"; \
+- .align 2 ; \
+- .type name,@function; \
+- .globl name; \
+-name:
+-
+ #define DOTSYM(a) a
+
+ #else
+@@ -247,20 +240,6 @@ GLUE(.,name):
+
+ #define _GLOBAL_TOC(name) _GLOBAL(name)
+
+-#define _KPROBE(name) \
+- .section ".kprobes.text","a"; \
+- .align 2 ; \
+- .globl name; \
+- .globl GLUE(.,name); \
+- .section ".opd","aw"; \
+-name: \
+- .quad GLUE(.,name); \
+- .quad .TOC.@tocbase; \
+- .quad 0; \
+- .previous; \
+- .type GLUE(.,name),@function; \
+-GLUE(.,name):
+-
+ #define DOTSYM(a) GLUE(.,a)
+
+ #endif
+@@ -279,13 +258,22 @@ n:
+
+ #define _GLOBAL_TOC(name) _GLOBAL(name)
+
+-#define _KPROBE(n) \
+- .section ".kprobes.text","a"; \
+- .globl n; \
+-n:
+-
+ #endif
+
++/*
++ * __kprobes (the C annotation) puts the symbol into the .kprobes.text
++ * section, which gets emitted at the end of regular text.
++ *
++ * _ASM_NOKPROBE_SYMBOL and NOKPROBE_SYMBOL just adds the symbol to
++ * a blacklist. The former is for core kprobe functions/data, the
++ * latter is for those that incdentially must be excluded from probing
++ * and allows them to be linked at more optimal location within text.
++ */
++#define _ASM_NOKPROBE_SYMBOL(entry) \
++ .pushsection "_kprobe_blacklist","aw"; \
++ PPC_LONG (entry) ; \
++ .popsection
++
+ #define FUNC_START(name) _GLOBAL(name)
+ #define FUNC_END(name)
+
+diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
+index d9c912b6e632..03756ffdcd71 100644
+--- a/arch/powerpc/kernel/misc_32.S
++++ b/arch/powerpc/kernel/misc_32.S
+@@ -328,7 +328,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
+ *
+ * flush_icache_range(unsigned long start, unsigned long stop)
+ */
+-_KPROBE(flush_icache_range)
++_GLOBAL(flush_icache_range)
+ BEGIN_FTR_SECTION
+ PURGE_PREFETCHED_INS
+ blr /* for 601, do nothing */
+@@ -358,6 +358,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
+ sync /* additional sync needed on g4 */
+ isync
+ blr
++_ASM_NOKPROBE_SYMBOL(flush_icache_range)
++
+ /*
+ * Flush a particular page from the data cache to RAM.
+ * Note: this is necessary because the instruction cache does *not*
+diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
+index cb195157b318..5d7e583f1588 100644
+--- a/arch/powerpc/kernel/misc_64.S
++++ b/arch/powerpc/kernel/misc_64.S
+@@ -66,7 +66,7 @@ PPC64_CACHES:
+ * flush all bytes from start through stop-1 inclusive
+ */
+
+-_KPROBE(flush_icache_range)
++_GLOBAL(flush_icache_range)
+ BEGIN_FTR_SECTION
+ PURGE_PREFETCHED_INS
+ blr
+@@ -109,7 +109,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
+ bdnz 2b
+ isync
+ blr
+- .previous .text
++_ASM_NOKPROBE_SYMBOL(flush_icache_range)
++
+ /*
+ * Like above, but only do the D-cache.
+ *
+--
+2.12.0
+
diff --git a/queue/series b/queue/series
index 540c9c0..5eb875a 100644
--- a/queue/series
+++ b/queue/series
@@ -29,6 +29,7 @@ metag-usercopy-Fix-src-fixup-in-from-user-rapf-loops.patch
metag-usercopy-Add-missing-fixups.patch
powerpc-Disable-HFSCR-TM-if-TM-is-not-supported.patch
powerpc-mm-Add-missing-global-TLB-invalidate-if-cxl-.patch
+powerpc-kernel-Use-kprobe-blacklist-for-asm-function.patch
powerpc-64-Fix-flush_-d-i-cache_range-called-from-mo.patch
powerpc-Don-t-try-to-fix-up-misaligned-load-with-res.patch
powerpc-crypto-crc32c-vpmsum-Fix-missing-preempt_dis.patch