OSDN Git Service

powerpc/kexec: blacklist functions called in real mode for kprobe
authorHari Bathini <hbathini@linux.ibm.com>
Wed, 14 Jul 2021 12:47:58 +0000 (18:17 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 26 Jul 2021 10:38:51 +0000 (20:38 +1000)
As kprobe does not handle events happening in real mode, blacklist the
functions that only get called in real mode or in kexec sequence with
MMU turned off.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/162626687834.155313.4692863392927831843.stgit@hbathini-workstation.ibm.com
arch/powerpc/kernel/head_64.S
arch/powerpc/kexec/core_64.c
arch/powerpc/mm/book3s64/hash_native.c
arch/powerpc/mm/book3s64/pgtable.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/platforms/ps3/htab.c
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/pseries/lpar.c

index 79930b0..f17ae20 100644 (file)
@@ -712,6 +712,8 @@ _GLOBAL(copy_and_flush)
        isync
        blr
 
+_ASM_NOKPROBE_SYMBOL(copy_and_flush); /* Called in real mode */
+
 .align 8
 copy_to_here:
 
index 8a449b2..84618d3 100644 (file)
@@ -72,7 +72,8 @@ int default_machine_kexec_prepare(struct kimage *image)
        return 0;
 }
 
-static void copy_segments(unsigned long ind)
+/* Called during kexec sequence with MMU off */
+static notrace void copy_segments(unsigned long ind)
 {
        unsigned long entry;
        unsigned long *ptr;
@@ -105,7 +106,8 @@ static void copy_segments(unsigned long ind)
        }
 }
 
-void kexec_copy_flush(struct kimage *image)
+/* Called during kexec sequence with MMU off */
+notrace void kexec_copy_flush(struct kimage *image)
 {
        long i, nr_segments = image->nr_segments;
        struct  kexec_segment ranges[KEXEC_SEGMENT_MAX];
index 52e170b..d8279bf 100644 (file)
@@ -787,7 +787,7 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
  * TODO: add batching support when enabled.  remember, no dynamic memory here,
  * although there is the control page available...
  */
-static void native_hpte_clear(void)
+static notrace void native_hpte_clear(void)
 {
        unsigned long vpn = 0;
        unsigned long slot, slots;
index 9ffa650..300099d 100644 (file)
@@ -172,8 +172,8 @@ pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
-/* For use by kexec */
-void mmu_cleanup_all(void)
+/* For use by kexec, called with MMU off */
+notrace void mmu_cleanup_all(void)
 {
        if (radix_enabled())
                radix__mmu_cleanup_all();
index e50ddf1..ae20add 100644 (file)
@@ -679,7 +679,8 @@ void radix__early_init_mmu_secondary(void)
        mtspr(SPRN_UAMOR, 0);
 }
 
-void radix__mmu_cleanup_all(void)
+/* Called during kexec sequence with MMU off */
+notrace void radix__mmu_cleanup_all(void)
 {
        unsigned long lpcr;
 
index 7ddc7ec..ef710a7 100644 (file)
@@ -169,7 +169,8 @@ static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn,
        spin_unlock_irqrestore(&ps3_htab_lock, flags);
 }
 
-static void ps3_hpte_clear(void)
+/* Called during kexec sequence with MMU off */
+static notrace void ps3_hpte_clear(void)
 {
        unsigned long hpte_count = (1UL << ppc64_pft_size) >> 4;
        u64 i;
index a81eac3..9c44f33 100644 (file)
@@ -195,9 +195,11 @@ fail:
 
 /**
  * ps3_mm_vas_destroy -
+ *
+ * called during kexec sequence with MMU off.
  */
 
-void ps3_mm_vas_destroy(void)
+notrace void ps3_mm_vas_destroy(void)
 {
        int result;
 
@@ -1243,9 +1245,11 @@ void __init ps3_mm_init(void)
 
 /**
  * ps3_mm_shutdown - final cleanup of address space
+ *
+ * called during kexec sequence with MMU off.
  */
 
-void ps3_mm_shutdown(void)
+notrace void ps3_mm_shutdown(void)
 {
        ps3_mm_region_destroy(&map.r1);
 }
index dab356e..869ef63 100644 (file)
@@ -801,7 +801,8 @@ static long pSeries_lpar_hpte_remove(unsigned long hpte_group)
        return -1;
 }
 
-static void manual_hpte_clear_all(void)
+/* Called during kexec sequence with MMU off */
+static notrace void manual_hpte_clear_all(void)
 {
        unsigned long size_bytes = 1UL << ppc64_pft_size;
        unsigned long hpte_count = size_bytes >> 4;
@@ -834,7 +835,8 @@ static void manual_hpte_clear_all(void)
        }
 }
 
-static int hcall_hpte_clear_all(void)
+/* Called during kexec sequence with MMU off */
+static notrace int hcall_hpte_clear_all(void)
 {
        int rc;
 
@@ -845,7 +847,8 @@ static int hcall_hpte_clear_all(void)
        return rc;
 }
 
-static void pseries_hpte_clear_all(void)
+/* Called during kexec sequence with MMU off */
+static notrace void pseries_hpte_clear_all(void)
 {
        int rc;