From patchwork Wed Sep 3 21:19:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 36659 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 67FFC202E4 for ; Wed, 3 Sep 2014 21:23:58 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf44287879oif.5 for ; Wed, 03 Sep 2014 14:23:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=FTToUcFcLRbDi5qDQsl3Oh+BnD/CAHlS7xmQuiRNkfE=; b=hhID8owNR+ukUn0SoTlXkiuFKdWZjJxyXBQpYgxg9HagITxGJcO+pE2UWCJnAomb7n KiQSanrMFyiPU7imr8UDGZMtPCeCZPwCkz8eHz7PCe7s1ASD0I1mVJSyCimsMpZdDPhq ucqfv6b4wsYXGPz1hiVncVRgPkjaWcqtHzXGrmDMgxOhAx5UaZEvA/21HafWG4us6viE uZkWeVrJFJLbe9I6YK7PxJpI3L5h4lVjiWMoLpy+3EemPiOhg8wMa28qV+yevdEdgrNU QwAijaGwKQUCZRzKsFz8/Km0N1gQl2M5xINb19/4OUs+voemgPMwvKaCPI0eu1JGKuEO c7wQ== X-Gm-Message-State: ALoCoQlW2Z1fmo8Aj8Dz7jGCzksA7cEWpbwscmpcA34q42alBTnVCfVc4xG4+1FK5Jui0pxIo9R8 X-Received: by 10.182.29.10 with SMTP id f10mr12543obh.23.1409779438062; Wed, 03 Sep 2014 14:23:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.119 with SMTP id f110ls5522qga.96.gmail; Wed, 03 Sep 2014 14:23:57 -0700 (PDT) X-Received: by 10.220.172.134 with SMTP id l6mr32435vcz.80.1409779437921; Wed, 03 Sep 2014 14:23:57 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id mj9si4458471vcb.41.2014.09.03.14.23.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so9553544vcb.2 for ; Wed, 03 Sep 2014 14:23:57 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr6983vdb.27.1409779437837; Wed, 03 Sep 2014 14:23:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp740474vcb; Wed, 3 Sep 2014 14:23:57 -0700 (PDT) X-Received: by 10.70.128.47 with SMTP id nl15mr480984pdb.93.1409779436919; Wed, 03 Sep 2014 14:23:56 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id u7si5010470pdn.82.2014.09.03.14.23.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Sep 2014 14:23:55 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPI0L-0005rt-7l; Wed, 03 Sep 2014 21:22:13 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPHy9-0002ge-1h for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Sep 2014 21:19:57 +0000 Received: from mail-ie0-f179.google.com ([209.85.223.179]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPHy5-00030c-Sx for linux-arm-kernel@lists.infradead.org; Wed, 03 Sep 2014 21:19:55 +0000 Received: by mail-ie0-f179.google.com with SMTP id tr6so10148963ieb.24 for ; Wed, 03 Sep 2014 14:19:29 -0700 (PDT) X-Received: by 10.42.254.129 with SMTP id ne1mr299570icb.29.1409779169272; Wed, 03 Sep 2014 14:19:29 -0700 (PDT) Received: from localhost.localdomain (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id m4sm6479293igr.20.2014.09.03.14.19.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:19:27 -0700 (PDT) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id s83LJP3P031079 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Wed, 3 Sep 2014 14:19:25 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id s83LJPPA031078; Wed, 3 Sep 2014 14:19:25 -0700 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pinskia@gmail.com Subject: [PATCH 17/24] ARM64: Add loading of ILP32 binaries Date: Wed, 3 Sep 2014 14:19:11 -0700 Message-Id: <1409779158-30963-18-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1409779158-30963-1-git-send-email-apinski@cavium.com> References: <1409779158-30963-1-git-send-email-apinski@cavium.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140903_221954_057475_4C69A917 X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on casper.infradead.org summary: Content analysis details: (-3.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.223.179 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.223.179 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Andrew Pinski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Andrew Pinski --- arch/arm64/include/asm/elf.h | 59 +++++++++++++++++++++++++++++++++++------ 1 files changed, 50 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 795dc9f..52083cd 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -16,6 +16,7 @@ #ifndef __ASM_ELF_H #define __ASM_ELF_H +#include #include /* @@ -188,25 +189,26 @@ typedef compat_a32_elf_greg_t compat_a32_elf_gregset_t[COMPAT_A32_ELF_NGREG]; ((x)->e_flags & EF_ARM_EABI_MASK)) #define compat_start_thread compat_start_thread -#define COMPAT_SET_PERSONALITY(ex) \ +#define COMPAT_A32_SET_PERSONALITY(ex) \ do { \ set_thread_flag(TIF_AARCH32); \ set_thread_flag(TIF_32BIT); \ } while (0) -#define COMPAT_ARCH_DLINFO +#define COMPAT_A32_ARCH_DLINFO do {} while (0) extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); -#define compat_arch_setup_additional_pages \ - aarch32_setup_vectors_page #else - typedef elf_greg_t compat_elf_greg_t; typedef elf_gregset_t compat_elf_gregset_t; #define compat_a32_elf_check_arch(x) 0 -#define COMPAT_SET_PERSONALITY(ex) -#define COMPAT_ARCH_DLINFO - +#define COMPAT_A32_SET_PERSONALITY(ex) do {} while (0) +#define COMPAT_A32_ARCH_DLINFO do {} while (0) +static inline int aarch32_setup_vectors_page(struct linux_binprm *bprm, + int uses_interp) +{ + return -EINVAL; +} #endif /* @@ -228,7 +230,46 @@ typedef compat_a32_elf_greg_t compat_elf_greg_t; typedef compat_a32_elf_gregset_t compat_elf_gregset_t; #endif -#define compat_elf_check_arch(x) compat_a32_elf_check_arch(x) +#ifdef CONFIG_ARM64_ILP32 +#define compat_ilp32_elf_check_arch(x) ((x)->e_machine == EM_AARCH64) +#define COMPAT_ILP32_SET_PERSONALITY(ex) \ +do { \ + clear_thread_flag(TIF_AARCH32); \ + set_thread_flag(TIF_32BIT); \ +} while (0) +#define COMPAT_ILP32_ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO_EHDR, \ + (elf_addr_t)(long)current->mm->context.vdso); \ +} while (0) +#else +#define compat_ilp32_elf_check_arch(x) 0 +#define COMPAT_ILP32_SET_PERSONALITY(ex) do {} while (0) +#define COMPAT_ILP32_ARCH_DLINFO do {} while (0) +#endif + +#define compat_elf_check_arch(x) (compat_a32_elf_check_arch(x) || compat_ilp32_elf_check_arch(x)) +#define COMPAT_SET_PERSONALITY(ex) \ +do { \ + if (compat_a32_elf_check_arch(&ex)) \ + COMPAT_A32_SET_PERSONALITY(ex); \ + else \ + COMPAT_ILP32_SET_PERSONALITY(ex); \ +} while (0) + +/* ILP32 uses the "LP64-like" vdso pages */ +#define compat_arch_setup_additional_pages \ + (is_a32_compat_task() \ + ? &aarch32_setup_vectors_page \ + : &(arch_setup_additional_pages)) + +#define COMPAT_ARCH_DLINFO \ +do { \ + if (is_a32_compat_task()) \ + COMPAT_A32_ARCH_DLINFO; \ + else \ + COMPAT_ILP32_ARCH_DLINFO; \ +} while (0) #endif /* CONFIG_COMPAT */