From patchwork Mon Jun 18 15:06:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salyzyn X-Patchwork-Id: 10472105 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 88EA36029B for ; Mon, 18 Jun 2018 15:34:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77C2F28A39 for ; Mon, 18 Jun 2018 15:34:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C88728A40; Mon, 18 Jun 2018 15:34:00 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 1147928A39 for ; Mon, 18 Jun 2018 15:34:00 +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=qxAJ5E6wx55d1KKpPox1/6112viBB7MnJZB8l8cd8tg=; b=u+qudFQawhuob/Oz1v6XfpxbEh rzbBa7udWBDVQFELNNRVBzvHL1IesTFlO7yrYJ7MHBYXz5MIZ3k0YieWqo8fRUeK2zSxCF7Y9Xm02 OrAkwI2vMLqQffdodaiVmdlJPMtyN9veNV2gqk33588mtkO6VnV6BgfrSDpa9IGcmsz5HqZKuUiTx pDZgJ3jPFDk/p1JsIqTft7aHi9R5NcLcfGM36E1rsB9fzT9JyIJmAdzghX94HDkLd7kXLe2uqTCQd U664rx5aK731XCly5bwP2reMA5WXJAjlgMSHL8xaZt3DRTWkAwigqpq4djaSlDPAlfzNOG9dODnm5 ibHzmLGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUwAB-000212-E2; Mon, 18 Jun 2018 15:33:51 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUvvl-0000OV-8p for linux-arm-kernel@bombadil.infradead.org; Mon, 18 Jun 2018 15:18:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=BQzyMHwh4XXfWMVFdnTKF232M wpDdXwy393yIdRkRK+cckO/ORO9xHzXDbNAOX47JsMlh6R3LYp2S7lXigrRKNnmGOdAw2A/mUWGrI yPRBL+kkjL3PErATiwKYJ+FKQdA1xgj1/oZ3y2BE+xkPTaz33r3fkUDJdRTLR1o2D4JWZgLR0uI8N cGYJFPWyn8IwjOcKDuM4gB8iNGQdVhVDb7T9NFWBGwhxtPHtvRQZlqtby7cPK+AqeoIvG6k/qZaRZ BoXXozbzkyXZzDbsiugXTaYoCzZ3cB2JTHd2/T9hjmWaD8ESKiUoBlBcOLWU0VeGKqnJWZgnV4U9g 1P0vHNjLQ==; Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUvn4-0000Jv-8W for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 15:09:59 +0000 Received: by mail-pf0-x242.google.com with SMTP id c22-v6so8335004pfi.2 for ; Mon, 18 Jun 2018 08:09:47 -0700 (PDT) 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=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=ucIjn0++CH4OhaJHuDa+OZmC0pCQ06dC+GAEZUn44AVJf0BAQ4xX5W9+Z5Nk4PPcKr 2q7g6DV+CThuuuVAcBtFP9OfiGZepMrfMRVDTOwx1l8QVNjks6Oji4VNlPrLN+HabGtT JQJFdigpH8CG9JkDKHG2mLbd270KF6mqtnUh7PBly1jE75WxxUVO6qZe6ab9SyqrQUzY Vww9J0R+IsauWXMT5rzL7WInwAF4nq6q3RU5eUxE8bjORlF6FrkJTNxzIM5LiJnjIeDY ik/BoYzZfOzmDGk8PMYuV7TMXtOBM3nMhpS9Xqv0owxr3OfObVbAyfpeibPeOp6W/NKM epFQ== 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=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=miNN4L235oUgGqmJCNJ5ifKhmNomgfmY0z2cbla1h4BC4iXiI7uf+2OuH/O2AG48BO WER9qoajFbvXJjnWfLr3eZqlI5jcrYsMxu6MSfr1c7DpicTAqfwTZ+jNrkbGLl2xKRxx bBJTMJPI/INJts86TpBP5MajQOYlNT7wSVmfUiEiDc2yl7OEeP9mWZz7WINTEUOMobV+ ulg6IVk4HVOw+U0LOL4QsolWqe/axT2MlDxyssw5Zy6RbM2CFxW0QtpSkcQlFQuKNeoN OJzn7NyzaTOyQ8d4xKGXeST3iQJNjhBExLIQP+lN0KtE1UVirP58c033HIHk8gQntvgb 5mmw== X-Gm-Message-State: APt69E2AkfKYls9Fs+yUMIOunb2agd3CBz2u9GaunDW1ZNtMPYfZS2VS rqguDGgi67ZRrjKtHXgafzZbYw== X-Google-Smtp-Source: ADUXVKJYlc0eu5sZ/nHjwg49lDyx8cQpAQfJGnjHKg1f8SFuos2UKntDa/IDY8mdYqypxbPJii59iA== X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr11230935pgn.80.1529334585815; Mon, 18 Jun 2018 08:09:45 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1611:6077:8eec:bc7e:d0f4]) by smtp.gmail.com with ESMTPSA id i7-v6sm54830660pfa.34.2018.06.18.08.09.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 08:09:45 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Subject: RESEND [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes Date: Mon, 18 Jun 2018 08:06:05 -0700 Message-Id: <20180618150613.10322-20-salyzyn@android.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180618150613.10322-1-salyzyn@android.com> References: <20180618150613.10322-1-salyzyn@android.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_110958_342169_C939ED4F X-CRM114-Status: GOOD ( 18.23 ) 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: Mark Rutland , Catalin Marinas , Will Deacon , Yury Norov , Andy Lutomirski , Russell King , Andy Gross , Laura Abbott , Ben Hutchings , Dave Martin , Kees Cook , Kevin Brodsky , John Stultz , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Dmitry Safonov , Jeremy Linton , Mark Salyzyn , James Morse , Andrew Pinski , Andrew Morton 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: James Morse Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Andy Lutomirski Cc: Dmitry Safonov Cc: John Stultz Cc: Mark Rutland Cc: Laura Abbott Cc: Kees Cook Cc: Ard Biesheuvel Cc: Andy Gross Cc: Andrew Pinski Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Jeremy Linton --- 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 433b9554c6a1..bf4672a0491b 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -147,10 +147,10 @@ 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); \ \ /* \ * Should always be nonzero unless there's a kernel bug. \ @@ -162,6 +162,7 @@ do { \ else \ NEW_AUX_ENT(AT_IGNORE, 0); \ } while (0) +#define ARCH_DLINFO _SET_AUX_ENT_VDSO #define ARCH_HAS_SETUP_ADDITIONAL_PAGES struct linux_binprm; @@ -209,7 +210,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 \