From patchwork Wed Nov 15 22:05:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salyzyn X-Patchwork-Id: 10060431 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 57CA46023A for ; Wed, 15 Nov 2017 22:07:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 505B629ED7 for ; Wed, 15 Nov 2017 22:07:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 449BD2A327; Wed, 15 Nov 2017 22:07:24 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E669F29ED7 for ; Wed, 15 Nov 2017 22:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=z5uJRzz+qkVvDFMuLIfObkm7dMl6xb1mIP1s/v5HkOg=; b=JdGvgacL+kVI2cApwXV9D14heb WlSpsT8YpXavfYkUezA0aLR2mVXjnIwxmA4eIB4ZebgH+O/YYAafYNQHValb9k4LdlxjguAv+T2BD RakHXQ5xy0zP4qRZQctltaVC35g8ZQx/Ot1tI0fnNPPd02/aU5T6YDrpJEDK4ENpVruYjDLfQlc0M UBETi20NO7WS0sWJILbbKiRvZXPHSWzPmzkbjwD+FuOLNQ8MS3OhSeUa9uixm0dbAmzsuNSgUL2WK OwFHRDUqWFMGaywEniv95sBJ+YcLIPNPDI00wWfxBdTHPiy5aIVT8+cuanHcrhkJfj5hH6pcC70i/ NhCMqLuA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eF5q7-0007S4-Ek; Wed, 15 Nov 2017 22:07:23 +0000 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eF5pg-0006wM-2M for linux-arm-kernel@lists.infradead.org; Wed, 15 Nov 2017 22:07:01 +0000 Received: by mail-it0-x242.google.com with SMTP id m191so3587064itg.2 for ; Wed, 15 Nov 2017 14:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0zazxrSXHQitEkgyDRUW7YJ40BEVPKTasLzuj8EOcMU=; b=YtrtRJrkPZt5jFPTFPLjJ2q5sUsuHtFiFACPm+6qG/ncgZ0DawEvg67y062rcxscwQ 4ooIodaT3sFWSqnKzPKtX9Lo0F5dG2X6fvPXCV0LhWDyNPsGMU9YKThcwJWgKt+SDYmM sWkUj9Lleg6vvVmdKemfuNpXUiOuxjoHkLJ2Mn1blrqqV1yXEHEPcp6xGnJWq4uyWXFh JJDMdDgMorfcoTQWlY5Q/qggPkM5nSa6eEqCn0/OKkc5Hi57r7Fq8qDlMy6J++PC7BDO UaXU0/JY0tY/z769abf1BcdhoJUEPlz/EIsOnGnis4kRJqcIlgWEl4nI4nlfGL/I2adB 4FjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0zazxrSXHQitEkgyDRUW7YJ40BEVPKTasLzuj8EOcMU=; b=BR4GvCg1ui+Jg8y2VTBD08JhuQubrj8FjqDwlHgttD1Ak/QYFPuwgtMzEP3PNiQSif Cuv9WlkVrykxgws/NPYY+RQN+cR5ohQCJ5bV52rvTDpkf+k2rbHGVNAXovJ7Qw0bM0cl 5OYYGgMs0ANapIVEYNpFN0FSRpSK5K/koJ3j3YZLIvbsIUx8hq9lwjY2UtEYzA8aIiwT Tw34GOEK/xgT8iROQ8mPcfIYVvA7bZjOeTDMZPBAFNpITHvDQge5ZYI+adOtLjH9u1PM 1z04wB5Kcz3E7LL7tMKLODLRTwzjdTNa8GcZDZOiXmv2B4EoXvZYOG4+MhpZYNKKXBYD 7IQQ== X-Gm-Message-State: AJaThX5QGZ2aTHchfW20HJ2vTqU61R8h0+omheX5UHyaLgGfoBMek6ML ONFq3M0E0zLT7C+1DN2Pcsa5pA== X-Google-Smtp-Source: AGs4zMa2b9viOm6wCyl2BKHdR2tPtMks7KHxEmfmrFg43GJhVYRT49adNRmYPOQkZvHFijEL+5aj1A== X-Received: by 10.36.78.3 with SMTP id r3mr21255768ita.134.1510783595166; Wed, 15 Nov 2017 14:06:35 -0800 (PST) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id 14sm5224751itj.34.2017.11.15.14.06.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 14:06:34 -0800 (PST) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Subject: [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes Date: Wed, 15 Nov 2017 14:05:12 -0800 Message-Id: <20171115220529.14458-3-salyzyn@android.com> X-Mailer: git-send-email 2.15.0.448.gf294e3d99a-goog In-Reply-To: <20171115220529.14458-1-salyzyn@android.com> References: <20171115220529.14458-1-salyzyn@android.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171115_140656_266287_E17DB774 X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Bo , Kees Cook , Catalin Marinas , Kevin Brodsky , Will Deacon , Mark Salyzyn , Yury Norov , "Eric W. Biederman" , Andrew Morton , Dave Martin , linux-arm-kernel@lists.infradead.org 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 From: Kevin Brodsky If the compat vDSO is enabled, we need to set AT_SYSINFO_EHDR in the auxiliary vector of compat processes to the address of the vDSO code page, so that the dynamic linker can find it (just like the regular vDSO). Note that we cast context.vdso to Elf64_Off, instead of elf_addr_t, because elf_addr_t is Elf32_Off in compat_binfmt_elf.c, and casting context.vdso to u32 would trigger a pointer narrowing warning. Signed-off-by: Kevin Brodsky Signed-off-by: Mark Salyzyn Cc: Catalin Marinas Cc: Will Deacon Cc: Dave Martin Cc: "Eric W. Biederman" Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/arm64/include/asm/elf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 33be513ef24c..675fa096d4a4 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -144,11 +144,12 @@ typedef struct user_fpsimd_state elf_fpregset_t; }) /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ -#define ARCH_DLINFO \ +#define _SET_AUX_ENT_VDSO \ do { \ NEW_AUX_ENT(AT_SYSINFO_EHDR, \ - (elf_addr_t)current->mm->context.vdso); \ + (Elf64_Off)current->mm->context.vdso); \ } while (0) +#define ARCH_DLINFO _SET_AUX_ENT_VDSO #define ARCH_HAS_SETUP_ADDITIONAL_PAGES struct linux_binprm; @@ -196,7 +197,11 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; ({ \ set_thread_flag(TIF_32BIT); \ }) +#ifdef CONFIG_VDSO32 +#define COMPAT_ARCH_DLINFO _SET_AUX_ENT_VDSO +#else #define COMPAT_ARCH_DLINFO +#endif extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); #define compat_arch_setup_additional_pages \