Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: tracking vDSO remap

Some processes (CRIU) are moving the vDSO area using the mremap system
call. As a consequence the kernel reference to the vDSO base address is
no more valid and the signal return frame built once the vDSO has been
moved is not pointing to the new sigreturn address.

This patch handles vDSO remapping and unmapping.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Laurent Dufour and committed by
Linus Torvalds
83d3f0e9 4abad2ca

+35 -1
+13
arch/powerpc/include/asm/mm-arch-hooks.h
··· 12 12 #ifndef _ASM_POWERPC_MM_ARCH_HOOKS_H 13 13 #define _ASM_POWERPC_MM_ARCH_HOOKS_H 14 14 15 + static inline void arch_remap(struct mm_struct *mm, 16 + unsigned long old_start, unsigned long old_end, 17 + unsigned long new_start, unsigned long new_end) 18 + { 19 + /* 20 + * mremap() doesn't allow moving multiple vmas so we can limit the 21 + * check to old_start == vdso_base. 22 + */ 23 + if (old_start == mm->context.vdso_base) 24 + mm->context.vdso_base = new_start; 25 + } 26 + #define arch_remap arch_remap 27 + 15 28 #endif /* _ASM_POWERPC_MM_ARCH_HOOKS_H */
+22 -1
arch/powerpc/include/asm/mmu_context.h
··· 8 8 #include <linux/spinlock.h> 9 9 #include <asm/mmu.h> 10 10 #include <asm/cputable.h> 11 - #include <asm-generic/mm_hooks.h> 12 11 #include <asm/cputhreads.h> 13 12 14 13 /* ··· 124 125 #ifdef CONFIG_PPC_BOOK3E_64 125 126 get_paca()->pgd = NULL; 126 127 #endif 128 + } 129 + 130 + static inline void arch_dup_mmap(struct mm_struct *oldmm, 131 + struct mm_struct *mm) 132 + { 133 + } 134 + 135 + static inline void arch_exit_mmap(struct mm_struct *mm) 136 + { 137 + } 138 + 139 + static inline void arch_unmap(struct mm_struct *mm, 140 + struct vm_area_struct *vma, 141 + unsigned long start, unsigned long end) 142 + { 143 + if (start <= mm->context.vdso_base && mm->context.vdso_base < end) 144 + mm->context.vdso_base = 0; 145 + } 146 + 147 + static inline void arch_bprm_mm_init(struct mm_struct *mm, 148 + struct vm_area_struct *vma) 149 + { 127 150 } 128 151 129 152 #endif /* __KERNEL__ */