From patchwork Wed Nov 25 12:49:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 7698911 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1A5A8BF90C for ; Wed, 25 Nov 2015 12:50:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40B85208F4 for ; Wed, 25 Nov 2015 12:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 417B1208ED for ; Wed, 25 Nov 2015 12:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752009AbbKYMt7 (ORCPT ); Wed, 25 Nov 2015 07:49:59 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51654 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbbKYMt6 (ORCPT ); Wed, 25 Nov 2015 07:49:58 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 644741405F7; Wed, 25 Nov 2015 12:49:57 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 4C2AD140631; Wed, 25 Nov 2015 12:49:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from keeshans.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com [67.52.130.30]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cov@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3D1BD1405F7; Wed, 25 Nov 2015 12:49:55 +0000 (UTC) From: Christopher Covington To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org, Christopher Covington , Jens Axboe , Andrew Morton , Jason Cooper , Laurent Dufour , Daniel Borkmann , Marc Zyngier , Ingo Molnar , Ard Biesheuvel , Mark Rutland , linux-kernel@vger.kernel.org Subject: [PATCH] arm64: Support VDSO remapping Date: Wed, 25 Nov 2015 07:49:29 -0500 Message-Id: <1448455781-26660-1-git-send-email-cov@codeaurora.org> X-Mailer: git-send-email 1.8.1.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some applications such as Checkpoint/Restore In Userspace (CRIU) remap and unmap the VDSO. Add support for this to the AArch64 kernel by copying in the PowerPC code with slight modifications. Signed-off-by: Christopher Covington --- arch/arm64/include/asm/Kbuild | 1 - arch/arm64/include/asm/mm-arch-hooks.h | 28 ++++++++++++++++++++++++++++ arch/arm64/include/asm/mmu_context.h | 23 ++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 arch/arm64/include/asm/mm-arch-hooks.h diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 70fd9ff..b112a39 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -25,7 +25,6 @@ generic-y += kvm_para.h generic-y += local.h generic-y += local64.h generic-y += mcs_spinlock.h -generic-y += mm-arch-hooks.h generic-y += mman.h generic-y += msgbuf.h generic-y += msi.h diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h new file mode 100644 index 0000000..e6923fb --- /dev/null +++ b/arch/arm64/include/asm/mm-arch-hooks.h @@ -0,0 +1,28 @@ +/* + * Architecture specific mm hooks + * + * Copyright (C) 2015, IBM Corporation + * Author: Laurent Dufour + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __ASM_MM_ARCH_HOOKS_H +#define __ASM_MM_ARCH_HOOKS_H + +static inline void arch_remap(struct mm_struct *mm, + unsigned long old_start, unsigned long old_end, + unsigned long new_start, unsigned long new_end) +{ + /* + * mremap() doesn't allow moving multiple vmas so we can limit the + * check to old_start == vdso_base. + */ + if ((void *)old_start == mm->context.vdso) + mm->context.vdso = (void *)new_start; +} +#define arch_remap arch_remap + +#endif /* __ASM_MM_ARCH_HOOKS_H */ diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index 2416578..9fe0773 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -147,4 +146,26 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, #define deactivate_mm(tsk,mm) do { } while (0) #define activate_mm(prev,next) switch_mm(prev, next, NULL) +static inline void arch_dup_mmap(struct mm_struct *oldmm, + struct mm_struct *mm) +{ +} + +static inline void arch_exit_mmap(struct mm_struct *mm) +{ +} + +static inline void arch_unmap(struct mm_struct *mm, + struct vm_area_struct *vma, + unsigned long start, unsigned long end) +{ + if ((void *)start <= mm->context.vdso && mm->context.vdso < (void *)end) + mm->context.vdso = NULL; +} + +static inline void arch_bprm_mm_init(struct mm_struct *mm, + struct vm_area_struct *vma) +{ +} + #endif