From patchwork Thu Sep 8 14:01:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 9321463 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 4D16B607D3 for ; Thu, 8 Sep 2016 14:05:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D67C29741 for ; Thu, 8 Sep 2016 14:05:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3275E29743; Thu, 8 Sep 2016 14:05:36 +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 97DED2979E for ; Thu, 8 Sep 2016 14:05:31 +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 1bhzvh-0007bk-8s; Thu, 08 Sep 2016 14:03:49 +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 1bhzuN-0006Kl-Qw for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2016 14:02:35 +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 80D415CA1; Thu, 8 Sep 2016 07:01:35 -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 BF49F3F21A; Thu, 8 Sep 2016 07:01:34 -0700 (PDT) From: Kevin Brodsky To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 5/8] arm64: compat: 32-bit vDSO setup Date: Thu, 8 Sep 2016 15:01:00 +0100 Message-Id: <20160908140103.7468-6-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160908140103.7468-1-kevin.brodsky@arm.com> References: <20160908140103.7468-1-kevin.brodsky@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160908_070228_445921_61E8A313 X-CRM114-Status: UNSURE ( 9.08 ) 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 , Dave Martin 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 d74f9ac7e336..97d37b64b146 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -139,6 +139,25 @@ up_fail: } #ifdef CONFIG_COMPAT +#ifdef CONFIG_VDSO32 +extern char vdso32_start, vdso32_end; + +static struct vdso_mappings vdso32_mappings; + +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. */ @@ -173,7 +192,7 @@ static int 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; @@ -197,6 +216,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;