From patchwork Wed May 16 08:18:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 10403043 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 3F04B602C2 for ; Wed, 16 May 2018 08:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DC9A2656B for ; Wed, 16 May 2018 08:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2162428807; Wed, 16 May 2018 08:31:41 +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=BAD_ENC_HEADER,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 986E42656B for ; Wed, 16 May 2018 08:31:40 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=egEfCVf6bFqTX5NFy8Uu+cUhkQI5yH8qQ0qs7t9xPNQ=; b=YlMibHN1gmN5Q9 LiQDBIB0zyD/RWYFGgEEHpRw19t7h7VKU5KLWvzPwoFVRIZmyIj54D74rfq8BO6lCHnW3cHiwNLAy Gvna2j1IJY7MfZCKvXFKiKTdGtrkjQWuXh45Gm511bDu8CQwTC/KXSMZLTp0nLhm8QQjBQm5WznMW sWYOFJ+c7EuobSwVyHlS4MnXD/7DV+dIncRdUM51eKlP4sl1Uqg0jYM0toghdhHpPM7g/IGHJTXg6 1QLJSSYBhxMzzhb2YFYPTyshnqPpMcuTsVsT2Mr6+aLtn68ZarCEAIf+lyXN1VTFgPoLlkbuCQV+5 j91uiF4lr9+C0p7LwS2A==; 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 1fIrqJ-0003P9-Rs; Wed, 16 May 2018 08:31:28 +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 1fIrhO-0004lA-Vx for linux-arm-kernel@bombadil.infradead.org; Wed, 16 May 2018 08:22:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: 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=KC+u30K3LLwe+U9aZGx2PCkPmeNS2XuZuXYB/UDYX6Y=; b=t/63rExn+7QxkHnm3AZa9dhAF uqzzx3CEKsvGa7ODK06EhDg4uGkq1RDJ/xt/QSbeZnNCQg66IZhevtYyTZ/wNcMM/G+nsLMQ3FA6J qx3DoWBva42D8a4QIXSq4NCRYJM1DdzCV3myCdrQwTPx12xcsMt9dqv26KNd9cbdO9GoBH21Vpsom 3NeJcyI60G01PW9v38gjmazkHE8jc1s8Vzvy4nuJXlPWonKweHLre3XKiaKC2JmDFjE14jhclSOA4 TdVy5WEZlGNVh/mOC7Xygr3HUJhg9PRMNXVjtoImOubq1O453LYwRfUHnAxDJyEVANscnrZWzNfCw 7elaH0QPw==; Received: from mail-cys01nam02on0060.outbound.protection.outlook.com ([104.47.37.60] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrhL-0001yr-GI for linux-arm-kernel@lists.infradead.org; Wed, 16 May 2018 08:22:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KC+u30K3LLwe+U9aZGx2PCkPmeNS2XuZuXYB/UDYX6Y=; b=RvwF5cHgU7lk0SNc5mDL7NJwfsQ1bgcT3J22LsoFxHwlUctnasY+98u0Z4Hi0E80EA+nNMHRZUNWkVvYkE0DoefdzdKUUN3KOJHs3kIf/7IA6jnQcaYLwn1zwckssxjfks2ukYjNN8sl2Ivkj4FVmBOpRpBAp/Ackje6ilzy150= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.36.13) by BN7PR07MB4371.namprd07.prod.outlook.com (2603:10b6:406:b5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Wed, 16 May 2018 08:21:57 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH 13/24] arm64: introduce binfmt_elf32.c Date: Wed, 16 May 2018 11:18:58 +0300 Message-Id: <20180516081910.10067-14-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516081910.10067-1-ynorov@caviumnetworks.com> References: <20180516081910.10067-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [176.59.36.13] X-ClientProxiedBy: VI1PR08CA0110.eurprd08.prod.outlook.com (2603:10a6:800:d4::12) To BN7PR07MB4371.namprd07.prod.outlook.com (2603:10b6:406:b5::11) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4371; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4371; 3:V8TKiRVLrT4dZFEkIrYB3lSwZ0SwbJt5ZDGK7b1kb669h/idSjoSwAyNT4JJqXtsUsl5v/P1GH/KLvl18CNKIeUmiGl0s/Js3o3A/JNyfQpAeFzAjW/iirAA7Sl97QeMs0Xrr2dlDzQexrsbEchUG/k1gaHvp2c4kmKD7LBKrj2Rw205MK+/CHdorloILfmcuq9paUaG7KDP6g91p8nzDhWq05UaX1VMMgcZkfWqScaD1VByoV/cfupLMw5ThCn6; 25:XuHbCkjpaoQltemGqnG168wblIs1fiw8+uAL50mWZCPLbMSxc9IYtQaGVKiZD2T23KW19CtqnJCYrXeeOxzas1oO7eb33SIiLsR0DnJlhXJ3B3RBsMo5L/QF2RH3xQvkFpa9ip5RDvNzE/x3G74qk2zQ+M8T4yzP2DJCltJr4w6YKl5SXxyd0SAvdbiIor8yrHi3nSZWPxieLwi2YdIXhlZx18QFwtZSK4F8Sd1u0XHYxFqsHDl56QrVBSLggnNa41fcZ8u8HZS0SeQ+pyR5N2G5a3c2F8psCZnayYdB+dqrE0NaxU7G/zzzOpMyKjkL9TyhsxGB3emHbrDyLGrAPA==; 31:Kg9tEcobjjPeV9VCIV9l33om5TPjKYMCPPAOJ14yUuMKRnuBnA2y5u3DdNIFRi8JazK9iTpK4OWT10ukXA20LYp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yiA49F7CRm1v33RHKfC9VHKJ1TzkQi5s4tPPUz5w4kzvg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:BN7PR07MB4371; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4371; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(346002)(39850400004)(366004)(396003)(39380400002)(199004)(189003)(956004)(2906002)(3846002)(2616005)(7406005)(42882007)(486006)(76176011)(446003)(6116002)(16586007)(16526019)(76506005)(386003)(50226002)(51416003)(476003)(305945005)(11346002)(7736002)(25786009)(7416002)(53936002)(4326008)(72206003)(6486002)(5660300001)(316002)(66066001)(39060400002)(52116002)(47776003)(48376002)(97736004)(81166006)(50466002)(81156014)(36756003)(54906003)(478600001)(106356001)(6496006)(186003)(68736007)(8676002)(8936002)(1076002)(105586002)(110136005)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4371; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN7PR07MB4371; 23:Sp+MWNVXTN+Xs35xFjbI+YxTQM00fp+D1rliHWuh7?= =?us-ascii?Q?xBWAcX/+N6vdDr8Ghnf1GkESRqwV/3VzFS8KjLiJgDdFRRiLiMOGwklwn7Mv?= =?us-ascii?Q?0nIvcrDGj05fZggdA+5OqYlJWVZzghMYwr1Yrl3nPoZ1UrpzR8Q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NEyG7zEM6mdGhT9RQd94ytaid6DtQa2syb4jZm5?= =?us-ascii?Q?EdVvDGU0FTHlHgtfnGeLacNAGjVdjRnz5QRBn2U9d3d3EhcFQsci8go+KQ/C?= =?us-ascii?Q?NdCOkWizD7tZWeegtWYaJy0EkCWepBpLNqd1ulhkLesBNeb4I3b8BdalTBKW?= =?us-ascii?Q?hw0UCCfUQ1uzfgz+fpCznFeuj79D9ndu7TYey/AcmwZdh8+qoCYrEqL7XWJh?= =?us-ascii?Q?VFony+vBxYH6qfgsR+ZeQhfrxunnZwn1l+f/xQcs1JfFJ34xlcR0XuK0DTrz?= =?us-ascii?Q?v3Ganig642wU+yc/Wg/HvY=3D?= X-Microsoft-Antispam-Message-Info: 1NODsKsTFp0IGs41Io43uhXXmqM7i3xgjzSRPEw//2vxMdIeMsM1exzaCPwXx8n8vUBBXlfQWeTn/xVVyHGnVjy/9SIO60SY0kn8slImTPgghAn4yyB32/amN2LahOa97oex0+UO9as2LV3k0bEkIWNstfpbWjz7z3kk4tnb+BV2m/G1LUHzxLPd3M0pkAFH X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4371; 6:Tr02gnCWVUv/GTAZtpGS/ldKrR0lFrGw1oG4lR8MDNVkXbUV5lI4hiwD+MAhInGiphv3DZKzBh9KbWw0FP5tNu/yDokvSY9mdChN7ktrUFcSAKFqNSLG4R9phCElkV2uNdy54mzS6CvPnZJNWrDixW9bIOrJYylp0D4AC+PKBWxQzejcTqM8deE72eN0Smnq02MyWNUfVfMjI28gqmMOTFfXI9ixzUBWdBchw763SEtl9Ba9i/4VzUrpbI4z3sp6CV58baKoE3banXbX0vCk+iEMCREzX0HXYAvUizavU0msntiZxdeNktfEAd8YSKeMH38W1BpPtbjWWAeJdCXURAx6uekbJldYvupWBEr+P/StuvczBx8gB/vk8S2+dx/3Yl1lJNC/wMcWU5qRAbqXnV5HIAdihNXzCmJvEYduTf4Sy//+8HjVsf99DzaYJblm/xRJF/QhIHW6aQqpcLODHQ==; 5:Xzl4faR+5T+fDhgqASoHrUCjSJXpSuQx8Kc87HaO0+GxzR72AJYArI0oOBFdFmllAnrp6v/5U4UIgULJ/fMzVZXLh/qoQH0n7EDUbsbhfvlnluvckEldzkTnRuw/ACyYDX2cZ9KPtvKNHeUVYypdPH5vu1r3TVDvR7eoL2L8ncw=; 24:Um6bMRoDQ7d6NCyn1Mlh1+Tl4bW6qCihYjMoHO6J+sLutMCqrR/1kcPffT94Cc7Raia8NqU69PdULVseFMnAJ5zBiKkwA77eUHJuCdXeG+0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4371; 7:QR6HKJ6TTYVSq9Zm0L384ukvDDk/yZYaq2+5NBIzgMXhjQhBOvMjoSccBc7seWkv0z6C9asdsY0zlh/QXLRUZLQPrbr8h/jWo1dSQ361jjIc/EjccFVuk2IcquN6eRWgs4IajCT0UcnTSYyovsvcowy/WYs0FxImQC++xyXNqIY0ebbynsDxKPPdFydWlCKunLSnmobK+/Wt+YYFzC4KHJedsjuLjxbzjIPZi/q8v0gGxNqJ7yeifkkIvLEB8Ag8 X-MS-Office365-Filtering-Correlation-Id: 3779ca4d-f6d8-4335-18f4-08d5bb06177e X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:21:57.4568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3779ca4d-f6d8-4335-18f4-08d5bb06177e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4371 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180516_042211_602127_BAC96A88 X-CRM114-Status: GOOD ( 18.01 ) 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: Szabolcs Nagy , Heiko Carstens , Yury Norov , Philipp Tomsich , Joseph Myers , Steve Ellcey , Prasun Kapoor , Andreas Schwab , Alexander Graf , Bamvor Zhangjian , Geert Uytterhoeven , Dave Martin , Adam Borowski , Manuel Montezelo , James Hogan , Chris Metcalf , Andrew Pinski , Lin Yongting , Alexey Klimov , Mark Brown , Maxim Kuvyrkov , Florian Weimer , Nathan_Lynch , James Morse , Ramana Radhakrishnan , Martin Schwidefsky , "David S . Miller" , Christoph Muellner 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/elf.h | 26 +++--------------------- arch/arm64/include/asm/hwcap.h | 2 -- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/binfmt_elf32.c | 35 ++++++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 arch/arm64/kernel/binfmt_elf32.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a16916be20f5..0685754a9f7b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1232,7 +1232,6 @@ config AARCH32_EL0 bool "Kernel support for 32-bit EL0" def_bool y depends on ARM64_4K_PAGES || EXPERT - select COMPAT_BINFMT_ELF if BINFMT_ELF select HAVE_UID16 select OLD_SIGSUSPEND3 select COMPAT_OLD_SIGACTION diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 023b2fbc1454..f04b27bd9bb6 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -175,36 +175,16 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, /* PIE load location for compat arm. Must match ARM ELF_ET_DYN_BASE. */ #define COMPAT_ELF_ET_DYN_BASE 0x000400000UL +#endif /*CONFIG_COMPAT */ +#ifdef CONFIG_AARCH32_EL0 /* AArch32 registers. */ #define COMPAT_ELF_NGREG 18 typedef unsigned int compat_elf_greg_t; typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; - -/* AArch32 EABI. */ -#define EF_ARM_EABI_MASK 0xff000000 -#define compat_elf_check_arch(x) (system_supports_32bit_el0() && \ - ((x)->e_machine == EM_ARM) && \ - ((x)->e_flags & EF_ARM_EABI_MASK)) - -#define compat_start_thread compat_start_thread -/* - * Unlike the native SET_PERSONALITY macro, the compat version maintains - * READ_IMPLIES_EXEC across an execve() since this is the behaviour on - * arch/arm/. - */ -#define COMPAT_SET_PERSONALITY(ex) \ -({ \ - clear_thread_flag(TIF_32BIT_AARCH64); \ - set_thread_flag(TIF_32BIT); \ - }) -#define COMPAT_ARCH_DLINFO extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); -#define compat_arch_setup_additional_pages \ - aarch32_setup_vectors_page - -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_AARCH32_EL0 */ #endif /* !__ASSEMBLY__ */ diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index 2c7fc5d89813..99dfd9277559 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 cff1a78bdf4c..c63e0164fc12 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -27,7 +27,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 000000000000..440fa84f62b3 --- /dev/null +++ b/arch/arm64/kernel/binfmt_elf32.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Support for AArch32 Linux ELF binaries. + */ + +/* AArch32 EABI. */ +#define EF_ARM_EABI_MASK 0xff000000 + +#define compat_start_thread compat_start_thread +/* + * Unlike the native SET_PERSONALITY macro, the compat version inherits + * READ_IMPLIES_EXEC across a fork() since this is the behaviour on + * arch/arm/. + */ +#define COMPAT_SET_PERSONALITY(ex) \ +({ \ + clear_thread_flag(TIF_32BIT_AARCH64); \ + set_thread_flag(TIF_32BIT); \ +}) + +#define COMPAT_ARCH_DLINFO +#define COMPAT_ELF_HWCAP (compat_elf_hwcap) +#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) + +#define compat_arch_setup_additional_pages \ + aarch32_setup_vectors_page + +/* AArch32 EABI. */ +#define compat_elf_check_arch(x) (system_supports_32bit_el0() && \ + ((x)->e_machine == EM_ARM) && \ + ((x)->e_flags & EF_ARM_EABI_MASK)) + + +#include "../../../fs/compat_binfmt_elf.c"