1
0
Fork 0
remarkable-linux/arch/powerpc/mm
Michael Neuling 609fbeddb2 powerpc: Avoid code patching freed init sections
commit 51c3c62b58 upstream.

This stops us from doing code patching in init sections after they've
been freed.

In this chain:
  kvm_guest_init() ->
    kvm_use_magic_page() ->
      fault_in_pages_readable() ->
	 __get_user() ->
	   __get_user_nocheck() ->
	     barrier_nospec();

We have a code patching location at barrier_nospec() and
kvm_guest_init() is an init function. This whole chain gets inlined,
so when we free the init section (hence kvm_guest_init()), this code
goes away and hence should no longer be patched.

We seen this as userspace memory corruption when using a memory
checker while doing partition migration testing on powervm (this
starts the code patching post migration via
/sys/kernel/mobility/migration). In theory, it could also happen when
using /sys/kernel/debug/powerpc/barrier_nospec.

Cc: stable@vger.kernel.org # 4.13+
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-13 09:27:28 +02:00
..
8xx_mmu.c powerpc/mm/slice: Fix hugepage allocation at hint address on 8xx 2018-06-05 11:42:00 +02:00
40x_mmu.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
44x_mmu.c powerpc: Delete __cpuinit usage from all users 2013-07-01 11:10:36 +10:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
copro_fault.c powerpc/mm: Update PROTFAULT handling in the page fault path 2017-02-15 20:02:39 +11:00
dma-noncoherent.c powerpc/mm: Rename map_page() to map_kernel_page() on 32-bit 2017-06-05 19:59:03 +10:00
dump_hashpagetable.c powerpc/mm: Use seq_putc() in two functions 2017-09-01 16:42:52 +10:00
dump_linuxpagetables.c powerpc/mm: Use seq_putc() in two functions 2017-09-01 16:42:52 +10:00
fault.c powerpc/mm: Fix SEGV on mapped region to return SEGV_ACCERR 2018-01-10 09:31:21 +01:00
fsl_booke_mmu.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
hash64_4k.c powerpc/mm: Fix lazy icache flush on pre-POWER5 2016-11-29 23:59:40 +11:00
hash64_64k.c powerpc/mm: Fix lazy icache flush on pre-POWER5 2016-11-29 23:59:40 +11:00
hash_low_32.S powerpc: fix location of two EXPORT_SYMBOL 2017-09-01 16:42:45 +10:00
hash_native_64.c powerpc/powernv: Fix kexec crashes caused by tlbie tracing 2017-12-05 11:26:31 +01:00
hash_utils_64.c powerpc/64: Call H_REGISTER_PROC_TBL when running as a HPT guest on POWER9 2018-04-24 09:36:27 +02:00
highmem.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugepage-hash64.c powerpc/mm: Move hash table ops to a separate structure 2016-07-21 18:59:09 +10:00
hugetlbpage-book3e.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugetlbpage-hash64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugetlbpage-radix.c powerpc/64s/radix: Fix 128TB-512TB virtual address boundary case allocation 2017-11-30 08:40:57 +00:00
hugetlbpage.c powerpc/mm/slice: Fix hugepage allocation at hint address on 8xx 2018-06-05 11:42:00 +02:00
init-common.c Merge branch 'topic/ppc-kvm' into next 2017-02-14 17:18:29 +11:00
init_32.c powerpc/mm/hugetlb: Add support for reserving gigantic huge pages via kernel command line 2017-08-16 14:56:12 +10:00
init_64.c powerpc/mm: Fix section mismatch warning in early_check_vec5() 2017-08-10 23:40:51 +10:00
mem.c powerpc: Avoid code patching freed init sections 2018-10-13 09:27:28 +02:00
mmap.c powerpc/64s/radix: Fix 128TB-512TB virtual address boundary case allocation 2017-11-30 08:40:57 +00:00
mmu_context.c powerpc/mm: Make switch_mm_irqs_off() out of line 2017-08-23 22:48:51 +10:00
mmu_context_book3s64.c powerpc/64s/hash: Fix fork() with 512TB process address space 2017-11-30 08:40:57 +00:00
mmu_context_hash32.c powerpc: Remove power3 from comments 2014-07-28 14:10:26 +10:00
mmu_context_iommu.c KVM: PPC: Book3S: Fix guest DMA when guest partially backed by THP pages 2018-09-09 19:55:58 +02:00
mmu_context_nohash.c powerpc/mm/slice: Fix hugepage allocation at hint address on 8xx 2018-06-05 11:42:00 +02:00
mmu_decl.h powerpc/8xx: Getting rid of remaining use of CONFIG_8xx 2017-08-10 23:32:12 +10:00
numa.c powerpc/numa: Ensure nodes initialized for hotplug 2018-04-26 11:02:13 +02:00
pgtable-book3e.c powerpc/mm: Make page table size a variable 2016-05-01 18:32:48 +10:00
pgtable-book3s64.c powerpc/mm/cxl: Add the fault handling cpu to mm cpumask 2017-08-17 23:31:52 +10:00
pgtable-hash64.c powerpc/mm: Use mm_is_thread_local() instread of open-coding 2017-08-23 22:27:45 +10:00
pgtable-radix.c powerpc/mm/radix: Split linear mapping on hot-unplug 2018-02-22 15:42:19 +01:00
pgtable.c powerpc/mm: Fix typo in set_pte_at() 2017-02-17 22:16:25 +11:00
pgtable_32.c powerpc/mm: Call flush_tlb_kernel_range with interrupts enabled 2017-10-04 22:15:30 +11:00
pgtable_64.c powerpc/mm: Flush radix process translations when setting MMU type 2018-02-22 15:42:16 +01:00
ppc_mmu_32.c powerpc32: refactor x_mapped_by_bats() and x_mapped_by_tlbcam() together 2016-03-11 17:18:02 -06:00
slb.c powerpc/64s: Fix compiler store ordering to SLB shadow area 2018-08-03 07:50:25 +02:00
slb_low.S powerpc/mm/hash64: Make vmalloc 56T on hash 2017-08-08 19:37:05 +10:00
slice.c powerpc/mm/slice: Enhance for supporting PPC32 2018-06-05 11:42:00 +02:00
subpage-prot.c powerpc/mm/hash: Free the subpage_prot_table correctly 2017-07-27 13:05:50 +10:00
tlb-radix.c powerpc/radix: Remove trace_tlbie call from radix__flush_tlb_all 2018-02-22 15:42:16 +01:00
tlb_hash32.c powerpc/mm: remove flush_tlb_page_nohash 2016-08-01 11:15:13 +10:00
tlb_hash64.c powerpc/mm: Use mm_is_thread_local() instread of open-coding 2017-08-23 22:27:45 +10:00
tlb_low_64e.S powerpc: Fix misspellings in comments. 2016-03-01 19:27:20 +11:00
tlb_nohash.c powerpc/nohash: Fix use of mmu_has_feature() in setup_initial_memory_limit() 2017-04-11 07:46:04 +10:00
tlb_nohash_low.S powerpc/8xx: Getting rid of remaining use of CONFIG_8xx 2017-08-10 23:32:12 +10:00
vphn.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vphn.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00