From patchwork Wed Aug 17 11:46:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285691 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 AE66E60459 for ; Wed, 17 Aug 2016 11:55:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A55DB28FDC for ; Wed, 17 Aug 2016 11:55:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99D5B28FE6; Wed, 17 Aug 2016 11:55:12 +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 0FB2828FDC for ; Wed, 17 Aug 2016 11:55:12 +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 1bZzPc-0005nE-9J; Wed, 17 Aug 2016 11:53:36 +0000 Received: from mail-co1nam03on0083.outbound.protection.outlook.com ([104.47.40.83] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzLL-0000s3-GA for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:49:22 +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=ukjhZAwLczoAqtMiohFucZR0F4yVcn4p1rhqBlso7Pk=; b=ficVPuNlYksiJL1qufGrW8eW+GmCyUmHlPA0Wcz4b1fgPGIluqbDonbAJ+1J9IRXAkqy8wuhyNIh01i5Ijpg1/TxfwnNHGg0PHkISnnx6rl8/LkoRYHQf67izsDxcZlH7kyw08m4ac7dxWqffBVdrMop5IwwRo2HDToBw2Z9wss= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Wed, 17 Aug 2016 11:48:16 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 09/18] arm64: introduce binfmt_elf32.c Date: Wed, 17 Aug 2016 14:46:34 +0300 Message-ID: <1471434403-25291-10-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA037.eurprd03.prod.outlook.com (10.141.191.165) To CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) X-MS-Office365-Filtering-Correlation-Id: faf25ff7-62d5-4e0b-7a3c-08d3c69460e5 X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 2:la83V/10pJAeVRD1Vmdj42h3DvmA3eNhE3621p6Jc0vTdazIET2psTKQ2Xtbx3EwD20z06EcpWh1IFayLDSfS+EPmcpHx+t0Ec0cArtIWvzfzIp0MCT1TKiqETyYlmh7pEXHpDqy+IfokhK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ofXcyN5IQXTtBVaT4rdhT2duO6SahfYYMb4K72BBVm9xkdHCy5ZooAlJwLl/Om8WpMRsU0rj5cUtWNeHaSlr2EHLpoGYXd6BmNBrxgMUMM9qWzFs9YfxD/z6f9sS36J7CDjgWGq9JzW1I8PCQmXI1RAKgUminO/ET60fsbcmt/KtvSJvhHq56qZiLkm1Zp7v/KKGO0tNZH887/pyuCcLj65llw/2B/ZCbb6uP4z9Ppr2kHXNEQjWus/hTTu1JA5FIgJ12/ROkE9vuT6DrQCqsSgXL1EVYvrWuTGOoxIb+X2pRQS0VeCyhckbpvQcv5H8ROxgw2t5cx4ahzpmHreVxipo2Rc3vz04VqW1awWoXhqKVwUwTEWtTwg5JtijMP3FmdwZMcEAKok8iv1s8jvshrknE/AvSv+y6bMc+yhlSLCgIyXA0VURewsyW53v2XnTx6tq/8kzibfdYdTfVoZYxvOZPYONV7w4teRRZsiSPW4= 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:CY1PR07MB2247; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 4:H1BZeTxUmOhOsxrAQ7SHt/RoopZWItLxqNNfc8BxT23uCHHzkMN/TU4uskP/g+UFs8AclNfhW1k4L1gviFYIOYUUqInN7AItmFhi4iNRXDlpmCop8g3iVPQqwHYkL9XdjrwY8+e8ZXRWZpUkqZACOIuiPczatYYcnpP6kweOOH194mN3AEIut8IgR0hIWcThufhsHxm9GTbrVrRezl4lQRUDYCGTH2TXdprubAD5al96wVqAkKn3xKZiKTLHiUPssNbay5xHP3yNAdCDalCls742gwBKgaNSEb/vdwavcjFBd8BOdi3SZMEUDzd7BQOPPQJy2xO+8XPhylnTUaazKdK6zDnrOTJ+I3/vDE82L2MQkaqiWOxLWC5LXrH6VcyR X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(81156014)(50466002)(36756003)(50986999)(81166006)(586003)(76176999)(8676002)(47776003)(66066001)(7416002)(6116002)(3846002)(48376002)(50226002)(92566002)(2201001)(77096005)(229853001)(2950100001)(305945005)(42186005)(97736004)(105586002)(68736007)(5001770100001)(76506005)(33646002)(106356001)(7846002)(7736002)(2906002)(189998001)(101416001)(19580405001)(5003940100001)(19580395003)(4326007)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2247; 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; CY1PR07MB2247; 23:D+gHovUf0RiT6tPLl9KCHXVtQl8WVlsBKZZqiosxu?= =?us-ascii?Q?ei3SexScpv+RrJ7cKhRQzYt5qrAK+5sceeQ8l1kq2QYsrG6R24m8Rou35nH/?= =?us-ascii?Q?gyZQgA3uNaUAOzo9V4a8HZhkjKtBnvhqwQuY0Mxj+atZMAm3RSeIOGYW4PjI?= =?us-ascii?Q?pegzQQD/YolBaje0z5S6GdY48rcB6xkUzveaMonKVFaYJl1cpSldDRMcG1Y8?= =?us-ascii?Q?H1O+l+Sq8ViTw24ljtGJuzm8i9MsVP2QhX/VYqaGBURpMcKC7jBcVqiTR+yw?= =?us-ascii?Q?YKSthcLDeHu3S+4iOwCC3KwtdUwylwCIVfgbk1M6v7WIwS135iHvA28SYh9M?= =?us-ascii?Q?vpUwMKuhQOc7CXoxUBnBmKe5Xb6AMeUYUo+L8V/y7gMc55I2GCMS8dEv4q91?= =?us-ascii?Q?TIQ5QfdQlI85ucEOSK5nZ4mGY2xxJxKuq2zJmD+PpMHmzVsQajt174ETFn9T?= =?us-ascii?Q?2JJdCw6/E78oI0/zYxIj0TKd7SwpffTB4rwBpn3BTRkP8e65mSkY1vKMkdnO?= =?us-ascii?Q?koWIztV7HE469GVD828o4urdNnP+5OfHr8zHV2TCmJ24dDu2I4hSz665dc9O?= =?us-ascii?Q?1va7DLibmZVObt6yqDHcKj75bGe4YpMC010quRWNuQYvIehZA4fr+ONmy/fu?= =?us-ascii?Q?2r/L5E73jnpjQF+9pA+aExNWfbCIsnD0hxywkKoM3W2FwrcIjJ8zTHGkYLE7?= =?us-ascii?Q?vaAh4Ubg4BV67qnld5eiO0OZFfFiZywlJGSrr4b7x6pxTwMq3EABVgpfa1e5?= =?us-ascii?Q?pGttdmYiTx6JpogTosb5R5lGSXyIK9ZfzHHJ2NsZUtwjhw962MHANL2RJp67?= =?us-ascii?Q?R41M4zxxOkNWYkgPD1WTDQ39hbLByPsnQF5xZFxe8MY5J5QSJxLwHerlyejh?= =?us-ascii?Q?yUczx7dGIr0lmqRW27qSrTeKcbpgrCJa89vC04rITvjvuqd9WJAbBjzj3LFX?= =?us-ascii?Q?8ouagILVtmHaKVhQw85NbANvjBHA48FthdMbxwScNI8/6NtTtfJEIzru2FoF?= =?us-ascii?Q?fBum+Ut5fqKf1sZIhtNvzwNAsAV55XPaDCyBU0I2e7GHIrm48wq1+mAmZbgO?= =?us-ascii?Q?CJaDULCYpV5SQiyfY+j1BzRfySdyTBkC8/ll7Wzy/NYbv8JIRXtVL6ewS3b7?= =?us-ascii?Q?D3UzhM0HP/AXC0P8PVbc6V4EcRO5TL6?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 6:qRQ+DIvPBK49Fs0LWkvX+em6hNe5AAMNWivBD7rBX6YQv+gPN0MMOU6rOP1vKen8BmvsZGaJqeE9rQtNWMX/k/gQ3KmHQ4HYIbxBOd46YDT2BRS2AHFAEK8Pp1CspONVOtRppBSXjAkmHPCImrjXa0w3zpE+QXs83L2OYL4Pp1Jo8imMLjkSJbJmA5uwWxTzoYCXVwEKAEk9dSgFcuKDB6ae9uuhRf/UaR2feFh4ggTuaooT5YihVjUExoUgClUuN+lUXTctYom1g2HuLejv/1UhHVVGIbLYvjn6AsaDxmE=; 5:hu7ga2q8DjZv1A8AeurEfbGWdPLkVJqtZQCFmI1486YR+wy3J1G8cE0W6azIG0fXRZkQUcX78Yc0r57gbl2TVEL/RH8ZoTguOh3NqmhEpeHoB/pJ4wSfj+37wbVUmpKogFjncxuuMpcbnbAsRH+4FA==; 24:tjYka+OgmUwno45bqkUhMDh6cvndQVgtvM+fI61SSRxx3UWeQeRgUClGDZK+sAMyhyMNAMIIRmHhSGpCXub1mUyVISuxl4W2HD+uqWiB1rc=; 7:16FTMUPM+cdiN8RSmollJOpCdAVvOLK9RWunwwisTtxumbtghpzEqVv1IVi5pqJYoqtLSa/g0jA5AP+ocU1xVH/tjk5KDsWppJ+Z2wwtVtV3QxvbFtqHABUja8KV1ESNpEFc3Yyk1qkEd86f3SxRQK5h7HlRHA/oYnWp2bI7QkI1S1iYeco3eDnHeTQbqbvFL4Gh6IbWNxwQ9NlIGkDkxcNv11xluL0da3gFcdzf7tEjsqt2PE36oJ+LVhYAiDqV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:48:16.8088 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2247 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_044912_309396_B3E8FDDC X-CRM114-Status: GOOD ( 10.40 ) 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 08ca1cb..3d46250 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -998,7 +998,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 4ec5886..949187c 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -26,7 +26,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"