From patchwork Thu Oct 27 16:30:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 9399913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F5CB600BA for ; Thu, 27 Oct 2016 16:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F2732A35F for ; Thu, 27 Oct 2016 16:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2439F2A367; Thu, 27 Oct 2016 16:37:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE7F12A35F for ; Thu, 27 Oct 2016 16:37:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bzneX-0002j0-Ti; Thu, 27 Oct 2016 16:35:41 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bzncI-0008KQ-Kk for linux-arm-kernel@lists.infradead.org; Thu, 27 Oct 2016 16:34:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8563B1529; Thu, 27 Oct 2016 09:32:22 -0700 (PDT) Received: from e107154-lin.arm.com (e107154-lin.cambridge.arm.com [10.2.131.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C56403F218; Thu, 27 Oct 2016 09:32:21 -0700 (PDT) From: Kevin Brodsky To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 5/8] arm64: compat: 32-bit vDSO setup Date: Thu, 27 Oct 2016 17:30:55 +0100 Message-Id: <20161027163058.12156-6-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161027163058.12156-1-kevin.brodsky@arm.com> References: <20161027163058.12156-1-kevin.brodsky@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161027_093323_154665_178B89F4 X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Brodsky , will.deacon@arm.com, dave.martin@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If the compat vDSO is enabled, install it in compat processes. In this case, the compat vDSO replaces the vector page. aarch32_setup_vectors_page has also been renamed to the more generic aarch32_setup_additional_pages to reflect both use cases. Signed-off-by: Kevin Brodsky --- arch/arm64/include/asm/elf.h | 6 +++--- arch/arm64/kernel/vdso.c | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index a55384f4a5d7..7da9452596ad 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -185,10 +185,10 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; #define compat_start_thread compat_start_thread #define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT); #define COMPAT_ARCH_DLINFO -extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, - int uses_interp); +extern int aarch32_setup_additional_pages(struct linux_binprm *bprm, + int uses_interp); #define compat_arch_setup_additional_pages \ - aarch32_setup_vectors_page + aarch32_setup_additional_pages #endif /* CONFIG_COMPAT */ diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index c239b1c15eb3..76fb5e9ca521 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -138,6 +138,25 @@ static int setup_vdso_pages(const struct vdso_mappings *mappings) } #ifdef CONFIG_COMPAT +#ifdef CONFIG_VDSO32 +extern char vdso32_start, vdso32_end; + +static struct vdso_mappings vdso32_mappings __ro_after_init; + +static int __init vdso32_init(void) +{ + return setup_vdso_mappings("vdso32", &vdso32_start, &vdso32_end, + &vdso32_mappings); +} +arch_initcall(vdso32_init); + +int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) +{ + return setup_vdso_pages(&vdso32_mappings); +} + +#else /* CONFIG_VDSO32 */ + /* * Create and map the vectors page for AArch32 tasks. */ @@ -172,7 +191,7 @@ static int __init alloc_vectors_page(void) } arch_initcall(alloc_vectors_page); -int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp) +int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { struct mm_struct *mm = current->mm; unsigned long addr = AARCH32_VECTORS_BASE; @@ -196,6 +215,7 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp) return PTR_ERR_OR_ZERO(ret); } +#endif /* CONFIG_VDSO32 */ #endif /* CONFIG_COMPAT */ extern char vdso_start, vdso_end;