From patchwork Thu Sep 8 13:53:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 9321447 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 B5A2260752 for ; Thu, 8 Sep 2016 13:59:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A668A295A5 for ; Thu, 8 Sep 2016 13:59:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B3B0295EA; Thu, 8 Sep 2016 13:59:35 +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 305F0295A5 for ; Thu, 8 Sep 2016 13:59:35 +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 1bhzq0-0001IT-Te; Thu, 08 Sep 2016 13:57:56 +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 1bhzn7-0006dD-Km for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2016 13:54:59 +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 7B6E65C93; Thu, 8 Sep 2016 06:54:25 -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 BB28E3F21A; Thu, 8 Sep 2016 06:54:24 -0700 (PDT) From: Kevin Brodsky To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/8] arm64: compat: 32-bit vDSO setup Date: Thu, 8 Sep 2016 14:53:21 +0100 Message-Id: <20160908135324.7112-6-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160908135324.7112-1-kevin.brodsky@arm.com> References: <20160908135324.7112-1-kevin.brodsky@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160908_065457_815657_6C3AD851 X-CRM114-Status: UNSURE ( 9.22 ) 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 24ed037f09fd..d811f81bdd11 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -183,10 +183,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 b9a1268c21c6..2b7f4dc44758 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -138,6 +138,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. */ @@ -172,7 +191,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; @@ -195,6 +214,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;