From patchwork Tue Dec 6 16:03:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 9462877 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 932E660236 for ; Tue, 6 Dec 2016 16:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 813A22840E for ; Tue, 6 Dec 2016 16:09:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7226828437; Tue, 6 Dec 2016 16:09:50 +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 E630D2840E for ; Tue, 6 Dec 2016 16:09:49 +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 1cEIHp-0006uu-VU; Tue, 06 Dec 2016 16:08:10 +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 1cEIG3-0005rU-Hq for linux-arm-kernel@lists.infradead.org; Tue, 06 Dec 2016 16:06:21 +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 30AAD165C; Tue, 6 Dec 2016 08:05:51 -0800 (PST) Received: from e107154-lin.arm.com (e107154-lin.cambridge.arm.com [10.1.207.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE19D3F220; Tue, 6 Dec 2016 08:05:49 -0800 (PST) From: Kevin Brodsky To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v3 08/11] arm64: compat: 32-bit vDSO setup Date: Tue, 6 Dec 2016 16:03:50 +0000 Message-Id: <20161206160353.14581-9-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161206160353.14581-1-kevin.brodsky@arm.com> References: <20161206160353.14581-1-kevin.brodsky@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161206_080619_809605_C20F7132 X-CRM114-Status: UNSURE ( 7.85 ) 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: Jisheng Zhang , Catalin Marinas , Kevin Brodsky , Nathan Lynch , Will Deacon , Christopher Covington , Dmitry Safonov 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 sigreturn page (it provides its own sigreturn trampolines). Cc: Will Deacon Cc: Catalin Marinas Cc: Nathan Lynch Cc: Christopher Covington Cc: Dmitry Safonov Cc: Jisheng Zhang Signed-off-by: Kevin Brodsky --- arch/arm64/kernel/vdso.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 4d3048619be8..473492f3ab2a 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -141,6 +141,20 @@ static int vdso_setup(struct mm_struct *mm, } #ifdef CONFIG_COMPAT +#ifdef CONFIG_VDSO32 + +static struct vdso_mappings vdso32_mappings __ro_after_init; + +static int __init vdso32_init(void) +{ + extern char vdso32_start, vdso32_end; + + return vdso_mappings_init("vdso32", &vdso32_start, &vdso32_end, + &vdso32_mappings); +} +arch_initcall(vdso32_init); + +#else /* CONFIG_VDSO32 */ /* sigreturn trampolines page */ static struct page *sigreturn_page __ro_after_init; @@ -196,6 +210,8 @@ static int sigreturn_setup(struct mm_struct *mm) return PTR_ERR_OR_ZERO(ret); } +#endif /* CONFIG_VDSO32 */ + #ifdef CONFIG_KUSER_HELPERS /* kuser helpers page */ @@ -249,7 +265,11 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) if (down_write_killable(&mm->mmap_sem)) return -EINTR; +#ifdef CONFIG_VDSO32 + ret = vdso_setup(mm, &vdso32_mappings); +#else ret = sigreturn_setup(mm); +#endif if (ret) goto out;