From patchwork Fri Oct 21 20:33:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9390097 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 7CB8260762 for ; Fri, 21 Oct 2016 20:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E0D929F2C for ; Fri, 21 Oct 2016 20:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62B9C29F39; Fri, 21 Oct 2016 20:41:51 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 C3CF429F2C for ; Fri, 21 Oct 2016 20:41:50 +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 1bxgc0-0000KO-46; Fri, 21 Oct 2016 20:40:20 +0000 Received: from mail-co1nam03on0061.outbound.protection.outlook.com ([104.47.40.61] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bxgXF-0002lU-BE for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2016 20:35:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sd1/uL+mfdypJzM4BVFIuS/DH2ZxOVyqtrjbh4xuI7Q=; b=Ncm8NrfX0CCIoRGQDjTdXAQinZuult1Eg/avVfL+KJuAnpUJ5XE/ZscZKM9k6NhtfKs4ME8O+LKmTieRh3chZpYG/Ltn7iCnvnjCq/F1D7bSt+Ak+x+IasRJCqaRGln/ow6rC/FfPplNGLHrqWDk3VOrEaLSz51ikPuViz7DybE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by CY1PR07MB2246.namprd07.prod.outlook.com (10.164.112.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Fri, 21 Oct 2016 20:35:03 +0000 From: Yury Norov To: , , , , , Subject: [PATCH 09/18] arm64: introduce binfmt_elf32.c Date: Fri, 21 Oct 2016 23:33:08 +0300 Message-ID: <1477081997-4770-10-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> References: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA051.eurprd03.prod.outlook.com (10.141.191.179) To CY1PR07MB2246.namprd07.prod.outlook.com (10.164.112.148) X-MS-Office365-Filtering-Correlation-Id: 23c99942-24ae-411c-2719-08d3f9f1bc87 X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2246; 2:XcxaYiXLnjqUCgWfhLAPuxgcfBSMwlxLsIOO8xrKZi9sBIi2sQMpg7bn18mahCz3bvgogdGUuX/SsIc1CpzCmL/RVdh9FfaiQlsWpx57KjyPG+yyZ9ryiFRUorIjFo8vY225e1rQ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+mxqdx/vLbFfGCq1D09HnbYfrnqx+kc1yh7w47YKkLUppgz0N9Y8wGCRA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2246; 31:eRxjm7es/KCXuVcvMMOMtuzTn19i0OQTwtXr2QUaOhkt/PVQNA/xQMTsSqP924UClMd9uHMH2dZDMhyMlbGVMXDiWgZNyL9uegGe22j3raSoGYeJVteozdInO+WGQO/jwOZYxKYiw4vdAOB9qk2u3z1raR0XNT/Z3Xo1x8G6sgV2uYWmr6uQ8gRNtU0WzLzPuKpWozE2Hj1R8ecOsQxxUic1fJ6j1jtLmm6JRMPf0xnTzGWZ8RubtRezQjLW43MHN4aMQnmQAifbcwQsrnniH2rDxJgO4YaxVCMDZaRfE14=; 20:86vMsZl2DEPJ6lv8VqOE5LKSzttyWumcxP+iwi2hUeGrjgKm6snTRrDQtDVigdX4jaSMBrALJygRf3/opAQGqUuUwXu3PmTi+DNYKQhAmCJsxgMYS1Hoza542/1iexXEv3uBSpKyKpIjgTgt1JC3bVCvl8yjwihZ07tP2VT6XNqZos3samuye7zuXmsA+m51J72bsQJt4XHuHcVZkAIvz7pYugrdV3r1hHTxSbSqFTM/n49pwqfh1r4UrnDUZKE6mL7yBVyXt83+zncWvm8OskKZnoYtU3IIaqPHZ0mesLsTMY091tkuRolHAa0motWZ26eYOP8RmvPOg8hESgnXJrvp9YlKbC/k5NknNrXeooN8wIGkPlvDaiUbpsx+dr5/vuZ9sK/PAJuB6g3/JcXwCygDFpw25p8bhb+kROab7nIIhfYXZ87OvPgUtcIwr8N+AUtJFbbF4NdlUIvt8T02E0UwcApN0KvyxexNnkwZEUDTMx42qs+iVR55Dp6XwaM8cXxv8UHBwWQOiSN+sbO5g1FgVny8r7+ROEx7flTQIwiyJz5YgeCpzb2Snb6kkKSpKY7/GHvJ88c4mnva1raupBzgUUPPNDYf+oqhH0u0z+E= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR07MB2246; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2246; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2246; 4:5SaIo2wN2Sk0HJOMGXhvSzfSwPnE7GScprvjWB+HlsljoYXT/xFGPnv2leViT15XGYkUpSU9+E34lipkc5gPKqz+RqToaAtwPO+uCMMWS4GX0deKV5AexayQcsJmUxE8BMk59RqC+FIaUcjM8CL021sL9EIVgMWLe4XZ1geJFPLmzBDvK+hz9AmqAFV4shSbiE40N4gkDYjlGI+EjlY3OaJ6+Arm2+Pt1n8HvAagEmNlMKPVW6iuDMdq466kOBjgFaS4SSHNcxSgIqE9u1gXT3pjcJgzJ6LEmVWPOh/xdLl2Gtv11V/yV3VttUXuVkCXPJ0/Mt9JSMb2AsqrquCWJjiLqLQd2succs1K8uKbaqIu9aJfaYAdrQX/D6j8g1GBAY36PEm5qD5SrhfsL4/nQg== X-Forefront-PRVS: 01026E1310 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(4326007)(101416001)(6116002)(76176999)(189998001)(50466002)(2906002)(3846002)(47776003)(97736004)(68736007)(105586002)(229853001)(66066001)(106356001)(92566002)(5003940100001)(77096005)(50226002)(5001770100001)(81166006)(76506005)(19580405001)(19580395003)(42186005)(7416002)(2950100002)(7846002)(81156014)(36756003)(586003)(33646002)(2201001)(5660300001)(50986999)(305945005)(48376002)(8676002)(7736002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2246; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2246; 23:hHjyo7p0GxnbSElPTqu+Q9H1zV7MZ1Ycs8zcj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3wNYHaGdRtTPAe6ToVAO0IBvmPaAlBvz5qnU8qYs9j0vvwnWIZ6wRxkExXddONmK+Y+m94Djdishz9y8vFp94ZJWhnGACwGibx1DtL4WmlSTZe8aYBHpzua+4APDJQdDkt3YCKxJA5Oe5m2VeAMv4+EatqH9p1BVb+mBLpFHPVMRq67lw+kaEo+2P3gstToEV/OaW/6W8X/NQIPshenN1PURJRT+9uUZP23Hdm+xZVRnVo3Km/JBoQ4SYlSlNfqq3ew= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2016 20:35:03.1186 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2246 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161021_133525_733134_EFB1798D X-CRM114-Status: GOOD ( 10.85 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, schwidefsky@de.ibm.com, davem@davemloft.net, christoph.muellner@theobroma-systems.com 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 As we support more than one compat formats, it looks more reasonable to not use fs/compat_binfmt.c. Custom binfmt_elf32.c allows to move aarch32 specific definitions there and make code more maintainable and readable. Signed-off-by: Yury Norov --- arch/arm64/Kconfig | 1 - arch/arm64/include/asm/hwcap.h | 2 -- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/binfmt_elf32.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 arch/arm64/kernel/binfmt_elf32.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 0cd786e..9efa86a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1003,7 +1003,6 @@ config AARCH32_EL0 def_bool y depends on ARM64_4K_PAGES || EXPERT select COMPAT - select COMPAT_BINFMT_ELF select HAVE_UID16 select OLD_SIGSUSPEND3 select COMPAT_OLD_SIGACTION diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index 2c7fc5d..99dfd92 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -47,8 +47,6 @@ #define ELF_HWCAP (elf_hwcap) #ifdef CONFIG_AARCH32_EL0 -#define COMPAT_ELF_HWCAP (compat_elf_hwcap) -#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) extern unsigned int compat_elf_hwcap, compat_elf_hwcap2; #endif diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 8a19fda..abe5040 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,7 +28,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE $(call if_changed,objcopy) arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ - sys_compat.o entry32.o + sys_compat.o entry32.o binfmt_elf32.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o diff --git a/arch/arm64/kernel/binfmt_elf32.c b/arch/arm64/kernel/binfmt_elf32.c new file mode 100644 index 0000000..aec1c8a --- /dev/null +++ b/arch/arm64/kernel/binfmt_elf32.c @@ -0,0 +1,31 @@ +/* + * Support for AArch32 Linux ELF binaries. + */ + +/* AArch32 EABI. */ +#define EF_ARM_EABI_MASK 0xff000000 + +#define compat_start_thread compat_start_thread +#define COMPAT_SET_PERSONALITY(ex) \ +do { \ + clear_thread_flag(TIF_32BIT_AARCH64); \ + set_thread_flag(TIF_32BIT); \ +} while (0) + +#define COMPAT_ARCH_DLINFO +#define COMPAT_ELF_HWCAP (compat_elf_hwcap) +#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) + +#ifdef __AARCH64EB__ +#define COMPAT_ELF_PLATFORM ("v8b") +#else +#define COMPAT_ELF_PLATFORM ("v8l") +#endif + +#define compat_arch_setup_additional_pages \ + aarch32_setup_vectors_page +struct linux_binprm; +extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, + int uses_interp); + +#include "../../../fs/compat_binfmt_elf.c"